简体   繁体   English

iOS滑出菜单

[英]iOS Slide Out Menu

I currently have a view controller that handles a facebook login as well as a landing page after the authentification named "homeViewController". 我目前有一个视图控制器,用于处理Facebook登录以及名为“ homeViewController”的身份验证后的登录页面。 What I would like is a nice slide out menu and layout to be presented on the "homeViewController". 我想要的是一个不错的滑出菜单和布局,将显示在“ homeViewController”上。 I found one I really like, but find the instructions on how to implement rather hard to follow being a beginner. 我找到了一个我真的很喜欢的人,但是找到了关于如何以初学者的身份很难实施的说明。 I have downloaded the source, and when running the source in xcode, everything is wonderful, so I know it works. 我已经下载了源代码,并且在xcode中运行源代码时,一切都很好,因此我知道它可以工作。 I find the instructions confusing because it tells me to include "REFrostedViewController.h" which I did, then it tells me to perform the following, but I don't have "DEMONavigationController: 我发现指令令人困惑,因为它告诉我包括我执行的“ REFrostedViewController.h”,然后它告诉我执行以下操作,但我没有“ DEMONavigationController”:

DEMONavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[DEMOHomeViewController alloc] init]];
DEMOMenuViewController *menuController = [[DEMOMenuViewController alloc] initWithStyle:UITableViewStylePlain];

// Create frosted view controller
//
REFrostedViewController *frostedViewController = [[REFrostedViewController alloc] initWithContentViewController:navigationController menuViewController:menuController];
frostedViewController.direction = REFrostedViewControllerDirectionLeft;

// Make it a root controller
//
self.window.rootViewController = frostedViewController;

Is there an easier way to get this menu working on my "homeViewController.m"? 有没有更简单的方法来使此菜单在我的“ homeViewController.m”上运行? Any help would be appreciated. 任何帮助,将不胜感激。

Instructions for slide out menu: https://github.com/romaonthego/REFrostedViewController 滑出菜单说明: https : //github.com/romaonthego/REFrostedViewController

The " DEMO " files you're referring to are found in the "Examples" folder in that GitHub Repo. 您要引用的“ DEMO ”文件位于该GitHub Repo 的“ Examples”文件夹中。

For your own use, you will need to take those demo files and modify them for your use and then drop them into your own project. 供您自己使用,您需要获取这些演示文件并对其进行修改以供使用,然后将其放入您自己的项目中。

As for your " homeViewController.m " file, I would imagine you'd replace the first line of that code with something like: 至于您的“ homeViewController.m ”文件,我想您将用以下内容替换该代码的第一行:

DEMONavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[homeViewController alloc] init]];

(by the way... you should name your Objective-C classes and files with capital letters. It's methods, properties and variable names that should start with lower case letters). (顺便说一下,您应该使用大写字母命名您的Objective-C类和文件。方法,属性和变量名称应以小写字母开头)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM