mikefrederick / mfsidemenu Goto Github PK
View Code? Open in Web Editor NEWFacebook-like side menu for iOS
License: Other
Facebook-like side menu for iOS
License: Other
If you pan the main view all the way to the right, the main view will lock against the right edge of the underlying menu.
Now, pan the main menu back to the left about a quarter inch. Don't remove your finger from the screen. Try panning the menu all the way to the right. You should be able to overshoot the right edge of the underlying menu. The main view will snap back into position once you remove your finger from the screen.
The main menu should lock into position on the right for both cases.
Hi !
I have a problem. I've created an MFSideMenu with a nil right view controller but the gesture recognizer is still working and try to show the right menu. This right menu should not be shown if it's nil.
Can you test it the pan gesture recognizer ?
Thanks for everything.
Benoit
This is a strange one. If you display a modal view while in the right menu and then dismiss it, the right menu view will be moved back to the left - i.e. its frame will change and it will have an origin of 0,0 instead of the origin that is offset by the kMFSideMenuSidebarWidth and its width will be the full screen.
Before showing the modal view:
Great library!
I'm new to iOS development and have one quick question - how can we disable the pan mode for specific view controllers (i.e. so that the behavior of swiping will not present the side menu controller)? The only 2 pan modes I could find were for the navigation bar and for the navigation controller -- can we disable those in some way?
Thanks again for your hard work.
How would I retain views which have already been loaded. So in the didSelectRowAtIndexPath of the SideMenuViewController it wouldn't recreate a view if the user has already seen it?
So for instance, if a map is selected in the side menu, and you zoom into New York, when you come back to that view later, it's already zoomed in.
For an example, see the demo project: Open sidebar menu, tap into the search field, tap on the menu button. Keyboard is still shown.
Hi,
Can you add in your method (MFSideMenuManager.m) :
+(void) configureWithNavigationController:(UINavigationController *)controller sideMenuController:(id)menuController {
[...]
//ADD THIS LINE
controller.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:controller.view.bounds].CGPath;
}
Thanks Vinicius Albino (comment on Cocoa Controls)
Hi there,
I noticed that the orientation isn't rotating in iOS5. I was able to fix it by by adding this in UINavigationController+MFSideMenu.m. Though this is deprecated in iOS6, this still works and fixes the problem.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
When i add a UITableViewController to my UINavigationController, when i do tap on the status bar doesn't scroll to top :(
My code in the MFAppDelegate.m... i used the demo project
DemoTableViewController *demoViewController = [[DemoTableViewController alloc] initWithNibName:@"DemoTableViewController" bundle:nil];
And 50 rows in 1 section to have scroll
Is there a solution to make it work?
Thanks for all :)
Hi
its great component to use it,currently facing issue when i add the Mailcomposer in the slidemenu,It was overwriting in the same slidemenu.May i know how to make the composer to come out of the slide menu,
Even i have tried on the top of the Demoviewcontroller facing same problem.
Can you please guide me to fix this issue.
It should be nice if the side menu can be disabled at a certain point by just calling a disable method on it. When it can be active again. We could call the enable method to activate it once again.
This could come in handy when you want to force your users through a wizard.
I've been playing around with the new version: 0.3
My app breaks In MFSideMenu.m - navigationControllerDidAppear on the line:
[menuView setTranslatesAutoresizingMaskIntoConstraints:NO];
It seems to be an iOS 6 only method.
Could you make the library iOS 5 (and higher) compatible?
Thanks
I tracked down the crash to line 497 in MFSideMenu.m:
if (self.navigationController.isViewLoaded)
self.navigationController.view.accessibilityViewIsModal = menuState == MFSideMenuStateClosed;
accessibilityViewIsModal is not available on iOS 4.3. I commented it out and the menu worked, so I think a respondsToSelector-check will do.
I’ve recently added MFSideMenu
to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects and provides a central repository for iOS/OS X libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, MFSideMenu
doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
This lib completely destroy the way navigation controllers work.
You are redefining UINavigationController appearance callbacks which is a really bad thing.
When you redefine a method in a category you completely replace this method with your own, it's not like inheritance where you have access to the super implementation.
To illustrate, consider the following code from UINavigationController+MFSideMenu.m
:
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.sideMenu performSelector:@selector(navigationControllerWillAppear)];
}
Calling [super viewWillAppear:animated]
here will call -[UIViewController viewWillAppear:]
and not -[UINavigationController viewWillAppear:]
.
I think many issues, particularly in iOS 5, are due to this bad design.
An option would be to create a UINavigationController subclass or use delegation.
How to show MFSlideMenu visible when went to DemoViewController.
I'd like to show menu when first look.
I tried:
[self.navigationController setMenuState:MFSideMenuStateHidden];
in viewDidLoad of DemoViewController. but it not working.
Hi, I am using the MFSideMenu together with a UITabbarcontroller.
My code as follows:
//Setting up of tab bar controllers
NSMutableArray *controllers = [NSMutableArray new];
[controllers addObject:[self sideMenu:feedNavigationController].navigationController];
[controllers addObject:[self sideMenu:popularNavigationController].navigationController];
[controllers addObject:[self sideMenu:questionsNavigationViewController].navigationController];
[controllers addObject:[self sideMenu:notificationNavigationViewController].navigationController];
[controllers addObject:[self sideMenu:profileNavigationViewController].navigationController];
[self.tabController setViewControllers:controllers];
Code to initiate sideMenu:
- (MFSideMenu *)sideMenu: (DMNavigationController*) navigationController {
DMSideMenuViewController *sideMenuController = [[DMSideMenuViewController alloc] init];
MFSideMenuOptions options = MFSideMenuOptionShadowEnabled|MFSideMenuOptionMenuButtonEnabled|MFSideMenuOptionBackButtonEnabled;
MFSideMenuPanMode panMode = MFSideMenuPanModeNavigationBar|MFSideMenuPanModeNavigationController;
MFSideMenu *sideMenu = [MFSideMenu menuWithNavigationController:navigationController
sideMenuController:sideMenuController
location:MFSideMenuLocationLeft
options:options
panMode:panMode];
sideMenuController.sideMenu = sideMenu;
return sideMenu;
}
In my sideMenuController, I have a didSelectRow event that adds a new controller on top of the current stack:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
DMUserProfileViewController *upvc = [[DMUserProfileViewController alloc]initWithNickname:[UserInfo sharedUserInfo].getNickname];
[self.sideMenu.navigationController pushViewController:upvc animated:NO];
[self.sideMenu setMenuState:MFSideMenuStateHidden];
}
}
The issue is that when I click on the tab to 'pop' to root view (after loading a new viewcontroller), the rootviewcontroller freezes i.e. I am unable to interact with the page at all e.g. scroll or click on cell etc
Is there any reason to cause the rootviewcontroller to freeze up?
Thanks and regards
Zhen
I have created my navigation controller with a root view controller of UIViewController. Basically a simple setup. When I programmatically create a UITableView and add it to the viewController, the swipe does not work in the body but only the navigation bar. If I dont add the tableview, it works perfectly with no issues.
I have set the datasource and tableview delegate to self as well so everything is linked up.
Not sure why it will not work with the table view added. I am using version 0.3
Thanks a lot!
When running on ios5 i receive this error
[UIView setTranslatesAutoresizingMaskIntoConstraints:]: unrecognized selector sent to instance 0x46dc40'
I believe it is because it is trying to set constraints where in ios5 it doesn't support this. I was thinking to check if it is ios5 and use AutoresizingMask instead else ios6 will continue to you constraints. Would this be the best way to go?
Whats the correct way of implementing the menu using Storyboards?
I couldn't make it work with the older Issue about this topic.
After adding the side menu, all my other table views lag. They went from buttery smooth to incredibly horrible to scroll.
Hi, please add support of CocoaPods for your project.
http://cocoapods.org/
This can also be simulated via the sample provided with MFSideMenu. When you pass for example 10 to numberOfRowsInSection, you will not be able to scroll to all menu items.
I'm using the latest version available via cocoapods. (0.4.1)
I have added this library to my project and it works great but since, my main view is a UIWEbView I need to browse to an address when I click on the buttons inside the side menu but I do not know how to do it exactly. I am not an experienced programming in iOS I am still learning how this framework work.
Usually, from other views I set a public property in the web view and then call viewDidLoad but I don't know how to call the web view's controller from side menu.
could you help me in any way?.
thank you
I want to use MFSideMenu in my code.
When I wrote this line
if (controller != nil) {
NSArray *controllers = [NSArray arrayWithObject:controller];
[MFSideMenuManager sharedManager].navigationController.viewControllers = controllers;
}
[MFSideMenuManager sharedManager].navigationController.menuState = MFSideMenuStateHidden;
It said there is not declared.
What should I do ?
And when I wrote :
if (controller != nil) {
NSArray *controllers = [NSArray arrayWithObject:controller];
self.sideMenu.navigationController.viewControllers = controllers;
}
self.sideMenu.menuState = MFSideMenuStateHidden;
It didn't work and menu didn't close after touch table cell
Present a modal with the Partial Curl effect and it will be rendered incorrectly, with transparency where there should be some shadow effects.
Can be fixed by completely disabling shadow on MFSideMenu or be setting rootViewController.view.layer.shadowOpacity to 0.0f before presenting the modal...
how can i use with storyboard?
I am using MFSideMenu, it looks great! Is it possible to just enable MFSideMenu for pan gesture in left 1/3 area of view instead of full view screen? Thanks.
my project is running with deployment target of 5.0,
which does not have Layout Constraints like ios 6.
It allways crash on devices with ios prior to ios6 with the following message.
'Could not instantiate class named NSLayoutConstraint'
which should be called on line MFSideMenu:177
could it be possible that you rewrite this for older ios prior version 6?
Regards,
Jan
Could come in handy. At this moment, they have to tap on the small section to close the menu.
I also use only one sideMenu at this moment.
I tried to have left & right menus but it fails with some constraint
Side menu items get selected innappropriately when it is hidden. I have fixed this on my fork and will send a pull request shortly.
There is another issue that I didn't address which is that there is a strange text field in the xib of the demo app. You really notice it when you use the app with Voice Over.
The left navigation button blinks when using MFSideMenu with storyboard. Any suggestion to fix it?
Hi,
Can't manage to scroll content vertically in DemoViewController. I've been wrestling with it for a bit, and it seems that the gesture recognizer is overriding the default behavior of UIScrollView.
Any ideas on how to address this?
Hi there,
When using a big table view inside a side menu controller, the frame of the menu controller is not fitting the app window frame.
How can we solve this ?
The bug occurs on both iOS 5/6.
Best regards,
Benoit
'm trying to integrate MFSideMenu in my project but I don't want to adopt the approach described in the GitHub depository as it defines the menu in the app delegate.
I have a login screen which will introduce with a segue (modal) a navigation controller with the main page as reported here: http://stackoverflow.com/questions/14084720/integrating-mfsidemenu-in-uinavigationcontroller
I would like to add the support for MFSideMenu in the navigationcontroller root controller using this code:
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
// Custom initialization
self.sideMenuController = [[SideMenuViewController alloc] init];
UINavigationController *navigationController = self.navigationController;
MFSideMenuOptions options = MFSideMenuOptionMenuButtonEnabled|MFSideMenuOptionBackButtonEnabled
|MFSideMenuOptionShadowEnabled;
MFSideMenuPanMode panMode = MFSideMenuPanModeNavigationBar|MFSideMenuPanModeNavigationController;
MFSideMenu *sideMenu = [MFSideMenu menuWithNavigationController:navigationController
sideMenuController:sideMenuController
location:MFSideMenuLocationLeft
options:options
panMode:panMode];
sideMenuController.sideMenu = sideMenu;
}
return self;
}
When I run the app the menu button appears in my navigation bar but,if I press on it,nothing happens.
Any idea about how to fix it?
Thanks a lot
An Observer is added but never removed.
Hi.
Thanks for a great lib!
There is one thing that would (in my opinion) make MFSideMenu a lot better! It's view controller containment. Imagine a scenario in which you would use MFSideMenu as the main window's RootViewController, having two properties for the menuViewController and contentViewController. It could potentially fix Issue #19, too.
Thank you for such a good library again:)
Hy there,
I used an older version on MFSideMenu, but now i upgraded it to the latest and my sideMenuButton no longer use the pan effect.
Actually i don't really used gestureRecognizers and i really need any time to spend my own code.
Can someone help to reenable this option? Like forcing
I'm having issues calling a method from the mainView Controller in the sideMenu Controller (which is a UITableView) in didSelectRow.
Basically, I have a UIWebView in the mainView Controller which I want to scroll using
and I can't figure out how can I call this method in the sideMenu Controller in the didSelectRow without instantiating a new mainView (if I instantiate a new one the method is called but of course, it does nothing).
Thank you !
If you implement MFSideMenu with only one side menu enabled, you'll find that panning doesn't work correctly. If you look at MFSideMenu.m, you'll find this code fragment:
If the rightSideMenuViewController is set to nil, the right side menu is locked out, which is the correct behavior.
However, if you've completely exposed the leftSideViewController, the if statement disables panning to the left, which makes the navigation controller appear to be locked into position on the far right.
The handleRightPan method has the same problem when leftSideViewController is set to nil.
You'll only see this problem under single menu implementations.
The fix is simple. If you want it, let me know.
Is there anyway to disable the right panning even when draggin the screen to the left?
i have a seachbar into the tableheder of side left menu... now..my search bar is cutted in half because the main view is over the side.
How can i show the entire side menu only in certain events? Like facebook app does when you tap on search bar?
i am looking for a method for doing this...now i am using
[self.navigationController.sideMenu setMenuState:MFSideMenuStateVisible];
for partially showing the menu table.
thanks
By default the menu appears underneath the detail controller.
I'd like the menu appear above the detail controller. In other words when the user pulls the menu it should slide over the detail controller (example can be seen in The magazine app: https://itunes.apple.com/us/app/magazine-for-geeks-like-us./id557744510?mt=8).
How can this be achieved?
Hi Mike, great project you've got here.
I'm having this issue where the side menu works just fine when debuging on my iPhone 4s but shows black when running it from an adhoc distribution (same device).
I really don't know where to start. Have you ever heard of anything like this?
This is how I instantiate the side menu:
CBYSideMenuViewController *sideMenuViewController =
(CBYSideMenuViewController *)[self.storyboard instantiateViewControllerWithIdentifier:SIDE_MENU_VIEW_CONTROLLER_ID];
self.sideMenu =
[MFSideMenu menuWithNavigationController:self.navigationController
leftSideMenuController:sideMenuViewController
rightSideMenuController:nil];
sideMenuViewController.sideMenu = self.sideMenu;
Screenshots
Debuggin from Xcode
Thanks in advance!
Hi ,
i have already modify the code in "MFSideMenuManager " to view the Left Table from view Controller instad of TableView using storyboard
is there any way to add two Menu on the Left and Right with different View Controller from the same class , i'm trying to create new object from the "MFSideMenuManager " and changing the Methods property but i could not do it , i did not know where is the problem
if you can help please
Hi all, I use 5.1 and I have running problem. When I run ademo app I obtain this error:
'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
If I disable Autolayout, app start but then crash whit other error:
2013-01-12 10:38:05.274 MFSideMenuDemo[875:c07] -[UITableView setTranslatesAutoresizingMaskIntoConstraints:]: unrecognized
Can you help me?
Thanks
If I use UITabBar and UINavigationController programmatically there is an issue with MFSideBarMenu.
The sideMenuController doesn't appear if there are more than one TabBarItem.
Code :
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.tabBarController = [[UITabBarController alloc] init];
NSMutableArray *tabs = [[NSMutableArray alloc] init];
HomeViewController *homeViewController = [[HomeViewController alloc] init];
[homeViewController setTitle:@"First"];
UINavigationController *homeNavigationController = [[UINavigationController alloc] initWithRootViewController:homeViewController];
[tabs addObject:homeNavigationController];
CatalogViewController *mySecondViewController = [[CatalogViewController alloc] init];
[mySecondViewController setTitle:@"Second"];
UINavigationController *secondNavigationController = [[UINavigationController alloc] initWithRootViewController:mySecondViewController];
[tabs addObject:secondNavigationController];
[self.tabBarController setViewControllers:tabs];
[self.window setRootViewController:self.tabBarController];
[self.window makeKeyAndVisible];
SidebarViewController *sideMenuViewController = [[SidebarViewController alloc] init];
MenuOptions options = MenuButtonEnabled|BackButtonEnabled;
[MFSideMenuManager configureWithNavigationController:homeNavigationController
sideMenuController:sideMenuViewController
menuSide:MenuLeftHandSide
options:options];
return YES;
}
Any solutions ?
Thanks
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.