aryaxt / ios-slide-menu Goto Github PK
View Code? Open in Web Editor NEWiOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
License: Other
iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
License: Other
Hey,
The "sliding navigation controller" in my app is not the initial view controller in the app. I set it up at the first time it appears, and it works fine.
Only problem is, I can't seem to get the navigation bar's title and buttons to show. The navigation bar keeps appearing empty.
I run this code in the "viewDidLoad" method of the first navigation controller that is embedded in the "sliding navigation controller":
// setup side menu
ICContentMenuViewController *contentMenu = [self.storyboard instantiateViewControllerWithIdentifier:@"menuController"];
[SlideNavigationController sharedInstance].leftMenu = contentMenu;
self.navigationController.view.backgroundColor = [UIColor whiteColor];
[SlideNavigationController sharedInstance].rightBarButtonItem = leftBarButtonItem;
self.navigationItem.title = @"Browse";
// Creating a custom bar button for left menu
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[button setImage:[UIImage imageNamed:@"MenuIcon"] forState:UIControlStateNormal];
[button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleLeftMenu) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
The menu gets set and loads fine, and the background color gets set, but no title and no button.
I also tried setting the title from the storyboard, but no luck... any idea what I'm missing here?
I want to have a certain class as the left navigation bar before the user logs in and another class after logging in.
Right now its not allowing me to do so by just setting the leftMenu variable, is there a specific way this will work?
Is it hard to implement navigate to menu by swipe after push another page?
Start your test application in vertical mode.
Login.
View rught menu - it's ok!
Then rotate device!
Look at the right menu - upper menu item is under the notification bar!
Nice work, looking to use this in a project which is already build in JQM Im new to IOS and have been trying to add a new view controller to the side menu control but it keeps crashing I am assigning a new class to the helper classes and inheriting form sidemenucontoller its probably because I'm a newbie can you help.
BTW this is not an issue as such more of help with adding new controllers to the exiting project.
greg
Hi, is there the possibility to have a slide menu that overlaps the main view and not "push" it away? Thanks!
I have to implement slide-menu with tabbar. Please guide me how could i do that?
Below is my code
//Initializinting Tabbar
tabBarControler = [[UITabBarController alloc]init];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
COHomeViewController *coHomeViewController = [[COHomeViewController alloc] initWithNibName:@"COHomeViewController" bundle:nil];
UINavigationController *coHomeNavController = [[SlideNavigationController alloc] initWithRootViewController:coHomeViewController];
coHomeNavController.navigationBarHidden = NO;
coHomeNavController.navigationBar.translucent = NO;
coHomeNavController.navigationBar.barTintColor = [UIColor blueHColor];
coHomeNavController.navigationBar.tintColor = [UIColor whiteColor];
coHomeNavController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
COCalendarViewController *coCalenderViewController = [[COCalendarViewController alloc] initWithNibName:@"COCalendarViewController" bundle:nil];
UINavigationController *coCalenderNavController = [[UINavigationController alloc] initWithRootViewController:coCalenderViewController];
coCalenderNavController.navigationBarHidden = NO;
coCalenderNavController.navigationBar.translucent = NO;
coCalenderNavController.navigationBar.barTintColor = [UIColor blueHColor];
coCalenderNavController.navigationBar.tintColor = [UIColor whiteColor];
coCalenderNavController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
COChatViewController *coChatViewController = [[COChatViewController alloc] initWithNibName:@"COChatViewController" bundle:nil];
UINavigationController *coChatNavController = [[UINavigationController alloc] initWithRootViewController:coChatViewController];
coChatNavController.navigationBarHidden = NO;
coChatNavController.navigationBar.translucent = NO;
coChatNavController.navigationBar.barTintColor = [UIColor blueHColor];
coChatNavController.navigationBar.tintColor = [UIColor whiteColor];
coChatNavController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
COCareLogViewController *coCarelogViewController = [[COCareLogViewController alloc] initWithNibName:@"COCareLogViewController" bundle:nil];
UINavigationController *coCarelogNavController = [[UINavigationController alloc] initWithRootViewController:coCarelogViewController];
coCarelogNavController.navigationBarHidden = NO;
coCarelogNavController.navigationBar.translucent = NO;
coCarelogNavController.navigationBar.barTintColor = [UIColor blueHColor];
coCarelogNavController.navigationBar.tintColor = [UIColor whiteColor];
coCarelogNavController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
COCareTeamViewController *coCareTeamViewController = [[COCareTeamViewController alloc] initWithNibName:@"COCareTeamViewController" bundle:nil];
UINavigationController *coCareTeamNavController = [[UINavigationController alloc] initWithRootViewController:coCareTeamViewController];
coCareTeamNavController.navigationBarHidden = NO;
coCareTeamNavController.navigationBar.translucent = NO;
coCareTeamNavController.navigationBar.barTintColor = [UIColor blueHColor];
coCareTeamNavController.navigationBar.tintColor = [UIColor whiteColor];
coCareTeamNavController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
self.tabBarControler.viewControllers = [NSArray arrayWithObjects:coHomeNavController,coCalenderNavController,coChatNavController,coCarelogNavController,coCareTeamNavController, nil];
self.tabbarBackground = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,320.0,50)];
[self.tabbarBackground setImage:[UIImage imageNamed:@"home_selectedCO.png"]];
[tabBarControler.tabBar addSubview:self.tabbarBackground];
tabBarControler.delegate = self;
COSlideViewController *coSlideViewController = [[COSlideViewController alloc] initWithNibName:@"COSlideViewController" bundle:nil];
[SlideNavigationController sharedInstance].leftMenu = coSlideViewController;
/// set animation type
id <SlideNavigationContorllerAnimator> revealAnimator = [[SlideNavigationContorllerAnimatorScaleAndFade alloc] initWithMaximumFadeAlpha:.6 fadeColor:[UIColor blackColor] andMinimumScale:.7];
[SlideNavigationController sharedInstance].menuRevealAnimator = revealAnimator;
self.window.rootViewController = tabBarControler;
[self.window makeKeyAndVisible];
Currently, I am getting following result. Only First tabbar item is responding to left swipe. But I want Nav Drawer till end. While other tabs are not swipable.
Please guide me.
I have a logout button, when i press this button the user should log in again, when the user log in correctly this message appears
"Singleton instance already exists. You can only instantiate one instance of SlideNavigationController. This could cause major issues".
I know why that's happen but i don't know how to remove the slideNavigationCntroller instance when the user press Logout
Hope you can help me
Hi Aryan!
I have a problem when i want switch to same view controller. If i want reuse a view controller with some little change within it exp: In view controller, have a variable name listType and each i init view controller, just change that variable. In left menu, i switch to that view, but slide menu just close menu. I think you need add a bool property, it can enable/disable switch to same view controller.
Thanks
Needs to work in both landscape and portrait, and needs to handle rotations properly
Hello,
I am creating tab bar application in which i use slider but my app crash when i click menu button.please give me suggestion how to fix that issue.
Thanks and Regards
Ankush
If you pass a UIButton wrapped in a UIBarButtonItem as a 'custom view' of the slide menu, clicking the button doesn't work, because the action and target are not set to the button, but they are set to the UIBarButtonItem
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:someButton];
[[SlideMenu sharedInstance].rightBarButtonItem = item;
Hello,
Here is what I got with Xcode 5.1 (many of them actually):
iOS-Slide-Menu-master/SlideMenu/en.lproj/MainStoryboard_iPad.storyboard: error: Illegal Configuration: Two view controllers have the same storyboard identifier "ProfileDetailViewController".
UITableViewCell scrollView dosen't work when trying to show delete confirmation button with swipe.
Hi;
Its really a great work. Thumbs up for you.
Only one recommendation use key frame animation in bounce function rather to have nested loops. That will make your code much readable.
Regards
So, I've gotten the slide menu configured as well as I can, and in truth, when I run my project, sliding from either side anchor's the top view controller to the side, except there's only a black screen below, not a tableView as I would like to think.
I have hooked up the LeftMenuViewController and RightMenuViewController to table views in the storyboard and set the correct code handlers for each ViewController. I can't seem to figure out why there's no tableView when I slide either right or left, only black.
Please help me. Thanks in advance.
Hello,
I don't know why, but my left menu doesn't appear, i have only a black background color.
Somebody know why ?
Thank you for your answer
Hello Aryan.
Can be done to "Swipe gesture" worked on secondary controllers?
I tried to setup according to instructions from readme, but the slide menu doesn't appear.
MenuViewController *menu = [[MenuViewController alloc] init];
[SlideNavigationController sharedInstance].leftMenu = menu;
Am I missing something?
Hi!
How to block all gestures in "HomeViewController" when he minimized?
http://www.youtube.com/watch?v=lbdWx5OlklY&feature=youtu.be - video
Currently, the switchToViewController method swaps the current view controller by popping to the root view controller then pushing another view controller on top of the stack. However, this causes the viewControllers array to contain two view controllers, which causes the displayed view controller to show a Back button in the NavigationBar. This is undesirable because the slide menu should be swapping view controllers between each selection, or clearing the viewControllers array before pushing a new view controller in.
For create flat design
I discovered this bug while trying to swipe the right-hand side menu away whilst in a view controller that was not the root one (e.g. a detail view).
If you go to a detail view controller that also has the side menu enabled, it is possible to slide back to the root view controller without dismissing the side menu. That might be difficult to explain, so I've created a video here to show how to reproduce the problem: https://drive.google.com/file/d/0B7hk_IdN2v-QNG5jelBoSzJxc1k/edit?usp=sharing
Steps to reproduce:
Expectations:
It should not be possible to dismiss the detail view controller in this way.
Hi, thank you for your excellent code, i have a problem with the implementation, i think that is like a bug with the segue, if i touch de menu button while the transition of the segue is happenning the app crash, any clue?
When I open the leftMenu, why is this View Black?
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Profe5" bundle:nil];
LeftTableViewController * menu = (LeftTableViewController *)[storyboard instantiateViewControllerWithIdentifier:@"LeftTableViewController"];
[SlideNavigationController sharedInstance].leftMenu = menu;
also I already have this Code
- (BOOL)slideNavigationControllerShouldDisplayLeftMenu {
return YES;
}
Somebody know why ?
Thank you for your answer
SlideMenu works for applications that contain only a single navigation controller.
SlideMenu overrides existing bar butoon items
For instance when adding a menu item manually in storyboard it'll be removed at launch time
Menu doesn't rotate properly when the app starts in landscape mode
Is there anyway to remove the bounce effect upon switchToViewController? I just want my viewController to appear on switchToViewController like when closing the slide navigation menu when tapping the leftBarButton (no bounce).
Is it possible to make it slide from right menu WITHOUT needing bar button items everytime? Not sure if i'm the only one who has this use case, I can implement it on my side.
i tried this.
OMVoidReadingsViewController *vError = (OMVoidReadingsViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"voidreadings"];
vError.txt1.text = @"FOR USER NO.2";
vError.txt2.text = @"PLEASE SWITCH TO USER NO.2. TAKE A READING AND THEN SYNC AGAIN";
vError.image.image = [UIImage imageNamed:@"device_user_22x.png"];
[[SlideNavigationController sharedInstance] switchToViewController:viewController0 withCompletion:nil];
I'm in the leftTableViewController from the SlideNavigationController, When I Select an other Controller, the SlideNavigarion works perfectly, but in the selected Controller y select popToRootController, it works but when i want to select a row the view is frozen
here's my code :
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Garulink"
bundle: nil];
if (indexPath.row==0 && indexPath.section==1) {
NSLog(@"0");
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewController *vc ;
vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"TodayEventTableViewController"];
[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc
withSlideOutAnimation:self.slideOutAnimationEnabled
andCompletion:nil];
}else if (indexPath.row==1) {
NSLog(@"1");
}else if (indexPath.row==2) {
NSLog(@"2");
[[SlideNavigationController sharedInstance] popToRootViewControllerAnimated:YES];
}else if (indexPath.row==3) {
NSLog(@"3");
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewController *vc ;
vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"PopularEventTableViewController"];
[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc
withSlideOutAnimation:self.slideOutAnimationEnabled
andCompletion:nil];
}else if (indexPath.row ==4) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewController *vc ;
vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"Events"];
[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc
withSlideOutAnimation:self.slideOutAnimationEnabled
andCompletion:nil];
}else if (indexPath.row ==5) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UIViewController *vc ;
vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"SuperInit"];
vc.navigationItem.hidesBackButton= YES;
[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc
withSlideOutAnimation:self.slideOutAnimationEnabled
andCompletion:nil];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"firstTime"];
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"cate"];
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"emailAndPass"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
maybe you can help me
thanks
Hi, is there any way to show the left menu only when the user click a Button?
Hello i tried to refres uitableviewcell and other labels in sidemenucontroller but viewdidload or viewwillappear only was called at the first time that menu is opened
Sometimes it is possible (quite easily) to get the wrong menu to appear on the opposite side with this component. I have provided a video which demonstrates how to reproduce, with the following steps:
I have also noticed this appearing through normal app usage, however this seems to be the most consistent way to reproduce the bug.
Here's the video: https://drive.google.com/file/d/0B7hk_IdN2v-QM3U5SlVwZ3ZvQ1k/edit?usp=sharing
Quick swipe would open the menu, even though slideNavigationControllerShouldDisplayLeftMenu or slideNavigationControllerShouldDisplayRightMenu are not implemented or return NO.
Issue 1:
steps to reproduce:
a) Hold the screen from any place nearly 60% or greater width.
b) Slide with screen until half or more but do not hold off the screen.
c) With some speed slide to opposite direction.
Outcome:
Menu in right side will appear in left side and vice-versa, and this issue occurs all the times when following the above steps.
Issue 2:
Using the same steps sometimes the blank screen is visible, but this issue is rare but occurs.
Issue 3:
When pushed to another child view controller then on each child controller the pan gesture of parent screen is always detected and the processes running on side panels underneath that are currently not visible nor the options/buttons to show left/right panel is present but the event of pan gesture is detected on child and the event on left/right panel that should occur only when visible is occurred underneath the child controller.
Hi, Me again. So Everything is working fine so far. Loving your control a lot by the way. One thing though. I want the slide menu to close a little bit faster after a selection has been made in the revealed menu. Is there a way to achieve this?
Thanks!
Your work is really cool!
I thing it more perfect if you can add some methods:
a. Make public 2 method:
Thanks so much!
Is there a way to know when menu is closed?
Is it possible to open menus, with sliding VC content or NavBar, in a view controller that has being pushed ?? I don't want to place a Menu button (///) in order to be able to open menus, I want the user to be able to open the menu no matter where it is.. or how deep in the navigation stack it is.
When switching between menu items, your current position is lost and you're routed back to the root screen for that menu section.
ex: i'm pushing some VC from menuItem1 and switch to menuItem2 after that, when i'm returning to menuItem1 my VC reloads (pushed VC disappear).
What I am doing is that I put SlidernavigationController in the middle of scenes. So SlidernavigationController is not initial rootViewcontroller. Then menuViewcontroller is black.
What should I change to apply SlidernavigationController after a couple of login process.
The reason why I don't want SlidernavigationController to be initialRootView is my segue style is modal in login process.
Thanks
How to set up this SlideMenu when I have multi storyboards and each storyboards has a navigation controller?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.