0
我試圖創建一個「初始設置頁面」,如果該應用程序是第一次在設備上啓動時顯示的。創建第一個啓動視圖控制器
我做了這樣的:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
{
NSLog(@"not first launch");
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"first launch");
}
}
現在我想創建一個視圖控制器推到這個視圖控制器如果它是第一次應用啓動。
我需要做什麼?
好看起來不錯你會建議創建視圖 - 控制的最好的地方? –
@ user1805901:我沒有得到你!哪個視圖控制器? –
我現在明白了;)非常感謝! –