iOS Slide/Swipe menu like facebook app

2019-03-22 08:26发布

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

5条回答
smile是对你的礼貌
2楼-- · 2019-03-22 09:05

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

查看更多
迷人小祖宗
3楼-- · 2019-03-22 09:07

if you are creating slide/swipe like facebook

application then follow link which is good example of this

https://github.com/edgecase/ECSlidingViewController

查看更多
Summer. ? 凉城
4楼-- · 2019-03-22 09:07

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

查看更多
Evening l夕情丶
5楼-- · 2019-03-22 09:18

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.

查看更多
叛逆
6楼-- · 2019-03-22 09:22

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.

查看更多
登录 后发表回答