Comments (12)
Hi,
Try to set allowLeftSwipe and allowRightSwipe variables of the sideMenu to false
from enswiftsidemenu.
Hi Evnaz,
- I changed the source code directly like:
private var menuPosition:ENSideMenuPosition = .Right
public var bouncingEnabled :Bool = false
public var allowLeftSwipe : Bool = false
public var allowRightSwipe : Bool = false
Left and right swipe are disabled, bouncing is disable neither, but why the side menu still slides from left instead of right? What should I do to make it slide from right side?
- Is it possible to customize the side menu height upon different page view, for example, there is bottom tool bar in home page, but other pages, so I want to make the side menu shorter in home page and longer in other pages?
Thanks.
from enswiftsidemenu.
I solved the 1st problem with setting menuPosition as right in ENSideMenuNavigationController init method like this in ObjCExample:
public init( menuTableViewController: UITableViewController, contentViewController: UIViewController?) {
super.init(nibName: nil, bundle: nil)
if (contentViewController != nil) {
self.viewControllers = [contentViewController!]
}
sideMenu = ENSideMenu(sourceView: self.view, menuTableViewController: menuTableViewController, menuPosition:.Right)
view.bringSubviewToFront(navigationBar)
}
How about the 2nd question? How to set up different height based on different pages? User constraint for side menu to bottom view?
from enswiftsidemenu.
If you use UITableView as a side menu view, you can set content insets:
tableView.contentInsets = UIEdgeInsetsMake(0, 0, toolBar.frame.size.height, 0)
from enswiftsidemenu.
How can I disable the switch page view animation, because my side menu slide out from right, the current switching page is also from right side, so I wanna show it without animation, just let the current page disappear and next one appear. I tried to change
UIView.animateWithDuration(0.1, animations: { () -> Void in
self.sideMenuContainerView.frame = destFrame
})
to
self.sideMenuContainerView.frame = destFrame
in ENSideMenu::toggleMenu() method, but it still doesn't work.
from enswiftsidemenu.
Hi Evnaz,
I update side menu table view part, add an variable currentIndex to get the current row in side menu, if clicked the side menu row whose page view is already open, then we close the side menu rather than load the page view again because we are already in the page. You can update it in the Objective C example.
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView setContentInset:UIEdgeInsetsMake(64.f, 0, 0, 0)];
[self.tableView setBackgroundColor:[UIColor clearColor]];
self.currentIndex = 0;
}
#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.currentIndex == indexPath.row) {
// close side menu
[[self.sideMenuController sideMenu] toggleMenu];
return;
}
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *destTVC = nil;
switch (indexPath.row) {
case 0:
destTVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController1"];
break;
default:
destTVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
break;
}
if (destTVC) {
self.currentIndex = (int)indexPath.row;
[self.sideMenuController setContentViewController:destTVC];
} else {
// close side menu
[[self.sideMenuController sideMenu] toggleMenu];
}
}
from enswiftsidemenu.
To disable animation on switch view controllers set sideMenuAnimationType of navigation controller to None
navigationController.sideMenuAnimationType = .None
from enswiftsidemenu.
How to initialize ENSideMenuNavigationController or ENSideMenu in a NavigationController or UIViewController class instead of assign it as root view controller in AppDelegate.m, because it's the not the 1st page in my case.
from enswiftsidemenu.
I tried to create a new view controller and init in - (void)viewDidLoad() method like following,
MenuItemsTVC *sideMenuTVC = [MenuItemsTVC new];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *contentVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController1"];
ENSideMenuNavigationController *navVC = [[ENSideMenuNavigationController alloc] initWithMenuTableViewController:sideMenuTVC contentViewController:contentVC];
[self addChildViewController:navVC];
[navVC didMoveToParentViewController:self];
navVC.view.frame = self.view.frame;
[self.view addSubview:navVC.view];
It can shows the content view controller and side menu, the only part which doesn't work is that there is no response when click at the cell of side menu.
I log out the debug info when select the cell like:
#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ NSLog(@"cur idx:%ld, index path row: %ld", (long)self.currentIndex, (long)indexPath.row);
if (self.currentIndex == indexPath.row) {
// close side menu
[[self.sideMenuController sideMenu] toggleMenu];
return;
}
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *destTVC = nil;
switch (indexPath.row) {
case 0:
destTVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController1"];
break;
default:
destTVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
break;
}
if (destTVC) {
self.currentIndex = (int)indexPath.row;
[self.sideMenuController setContentViewController:destTVC]; NSLog(@"cur vc: %@", destTVC.description); NSLog(@"vcs num: %lu", (unsigned long)self.navigationController.viewControllers.count);
} else {
// close side menu
[[self.sideMenuController sideMenu] toggleMenu];
}
}
and it shows:
2015-05-22 16:34:27.158 FS[15532:588753] cur idx:0, index path row: 0
2015-05-22 16:34:31.775 FS[15532:588753] cur idx:0, index path row: 1
2015-05-22 16:34:31.777 FS[15532:588753] cur vc: <ViewController: 0x7ffbd15334f0>
2015-05-22 16:34:31.777 FS[15532:588753] vcs num: 0
2015-05-22 16:34:43.673 FS[15532:588753] cur idx:1, index path row: 0
2015-05-22 16:34:43.674 FS[15532:588753] cur vc: <ViewController: 0x7ffbd32afc60>
2015-05-22 16:34:43.674 FS[15532:588753] vcs num: 0
it seems view controllers are not in navigation controller stack anymore.
from enswiftsidemenu.
Is there any Objective C version published for this side menu?
from enswiftsidemenu.
You can use this control in a ObjC project. ObjC example is in the repo.
from enswiftsidemenu.
I tried integrate the side menu like OjbC example which is the very first controller and it works. But I added it in my current project flow which shows the first content page of side menu after user sign in, it can show and hide side menu and it can also log out the cell index number when click at the side menu row, but it cannot direct to the target page (view controller) like example. Is it because the side menu nav controller is not first entry and side menu not well configured?
I tried to create a new view controller and init in - (void)viewDidLoad() method like following:
MenuItemsTVC *sideMenuTVC = [MenuItemsTVC new];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *contentVC = [storyboard instantiateViewControllerWithIdentifier:@"ViewController1"];
ENSideMenuNavigationController *navVC = [[ENSideMenuNavigationController alloc] initWithMenuTableViewController:sideMenuTVC contentViewController:contentVC];
[self addChildViewController:navVC];
[navVC didMoveToParentViewController:self];
navVC.view.frame = self.view.frame;
[self.view addSubview:navVC.view];
from enswiftsidemenu.
Related Issues (20)
- Tableview frame
- When I go back my previous screen data of text field disappears
- Issue when adding subviews
- Cocoapods needs update HOT 1
- crash on outside call
- When swipe disabled, pan not working.
- How to decrease the width of side menu and how to change the appearance of main view controller ?
- Logout screen HOT 5
- How to change navigation bar color for specific view controller?
- Can not add side menu from storyboard.
- How to adapt ENSwiftSideMenu to iPad HOT 1
- menu swipes from left when logout
- how can we change menu items?
- // TODO: add blur for ios 7
- Covering TabBar? HOT 1
- How to disable menu open pan gestures for other views except one view HOT 3
- Download Swift 4 Version
- Navigate to back pop view controller ??
- side menu not open
- How to reload sidemenu view
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enswiftsidemenu.