iOS Slide/Swipe menu like facebook app

2019-03-22 09:16发布

问题:

I know there are tons of projects, I searched in https://www.cocoacontrols.com/ and found some very interesting, like MasterDetailController, that is the simlpest one and I got working very good.

But now I have a problem, and probabbly you can help me with another cool and simple slide control, or just a matter of simple tweak of current control or coding.

The main issue is that the MasterDetailController must be set on self.window.rootViewControler = self.principal;

/* THIS IS THE APPDELEGATE */
// This is the slide menu view controller
UIViewController *master = [[UIViewController alloc] initWithNibName: @"MasterView" bundle: nil];
// This is the body view controller
ViewController *detail = [[ViewController alloc] initWithNibName: @"ViewController" bundle: nil];
// This is the Master detail controller 'driver'
self.principal = [[[MasterDetailController alloc] initWithMasterViewController: master detailViewController: detail] autorelease];
// Then we set the 'driver' as rootView
self.window.rootViewController = self.principal;
[self.window makeKeyAndVisible];

Now, I want more ViewControllers to have the slide menu like facebook app not just the rootViewController.

So, how can I do it?

Thanks.

PS: This is the control I am currently using https://www.cocoacontrols.com/controls/masterdetailcontroller

回答1:

if you are creating slide/swipe like facebook

application then follow link which is good example of this

https://github.com/edgecase/ECSlidingViewController



回答2:

How about this: https://www.cocoacontrols.com/controls/uiscrollslidingpages. Sliding scrolling viewcontroller. Instead of rootviewcontroller, pass this...



回答3:

You assign the slidecontroller to the uiview and then set the rootviewcontroller to your viewcontroller. This means that the slideviewcontroller will only work with the assigned view.

If you want to use the slidecontroller for other viewcontrollers you should do it the other way around and set the rootViewController to the slidecontroller.



回答4:

Here is one I wrote. Pretty simple to use. It's built on top of UINavigationcontroller and doesn't require any kind of sub-classing on your view controllers.

https://github.com/aryaxt/iOS-Slide-Menu



回答5:

You can use this simple library

https://github.com/arturdev/AMSlideMenu

This exactly what you need. Its FULLY customizable and with different animations. In demo project you can see how to implement multiple menus/viewControllers in your app.