【发布时间】:2013-06-28 19:01:20
【问题描述】:
这是 AppDelegate 中的 didFinishLaunchingWithOptions 方法。 让我解释一下场景,我在我的应用程序中开发了类似 facebook 的 sideMenu,但现在我必须根据屏幕(ViewController)更改 sideMenu 列表
这里的side Menu是SideMenuViewController,是contain中的一个参数,最终成为window的rootViewController。
所以,出现的最基本问题是“如何更改成为 windows 的 rootViewController 的控制器或变量”
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SideMenuViewController *leftMenuViewController = [[SideMenuViewController alloc] init];
self.container = [ContainerOfSideMenuByVeerViewController
containerWithCenterViewController:[self navigationController]
leftMenuViewController:leftMenuViewController];
self.window.rootViewController = self.container;
[self.window makeKeyAndVisible];
return YES;
}
如果有程序员想了解更多代码或需求,欢迎通过编辑我的代码或在 cmets 中提供。
【问题讨论】:
标签: ios appdelegate rootview