![](/img/trans.png)
[英]Storyboard: Changing the Root View of a UINavigation Controller Specified in a Storyboard
[英]Root View Controller not changing on BOOL
如果應用程序已打開一次,我試圖更改Root View控制器。 我在做什么。 布爾函數功能齊全,我知道,因為它顯示“ Welcome Back”。 這是我正在嘗試做的事情。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
{
// App Already launched
RootMenuController *viewController = [[RootMenuController alloc] init];
[UIApplication sharedApplication].keyWindow.rootViewController = viewController;
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
// This is the first launch ever
}
[self.window makeKeyAndVisible];
return YES;
}
似乎您沒有正確設置/更新應用程序窗口。 我創建了一個示例項目,可能會有所幫助。 https://github.com/deepthit/UpdateRootViewController.git
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.