在创建项目的时候默认的是用storyboard的,但是有时我们需要添加引导页,方法如下
在Applegate.m文件中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
NSLog(@"%d",[[NSUserDefaults
standardUserDefaults]boolForKey:@"firstLaunch"]);
if(![[NSUserDefaults
standardUserDefaults]boolForKey:@"firstLaunch"])
{
[[NSUserDefaults
standardUserDefaults]setBool:YES
forKey:@"firstLaunch"];
UIStoryboard *storyboard = [UIStoryboard
storyboardWithName:@"Storyboard"
bundle:nil];
self.window.rootViewController
= storyboard.instantiateInitialViewController;
}
else
{
UIStoryboard *story = [UIStoryboard
storyboardWithName:@"Main"
bundle:nil];
self.window.rootViewController
= story.instantiateInitialViewController;
}
// Override point for customization after application launch.
return
YES;
}
修改这个方法即可。