【发布时间】:2012-12-12 08:15:54
【问题描述】:
我正在尝试创建一个“初始设置页面”,如果应用程序首次在设备上启动,则会显示该页面。
我是这样设计的:
- (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");
}
}
现在我想创建一个视图控制器并在应用程序第一次启动时推送到该视图控制器。
我需要做什么?
【问题讨论】:
标签: ios objective-c cocoa-touch uiviewcontroller