这段代码写在APPDelegate.m中
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc]initWithFrame:
[[UIScreen mainScreen]bounds]];
firstViewController *firstVC = [[firstViewController alloc]initWithNibName:@"firstViewController"
bundle:nil];
mainViewController *mainVC = [[mainViewController alloc]
initWithNibName:@"mainViewController" bundle:nil];
BOOL numb = [[NSUserDefaults standardUserDefaults]
boolForKey:@"number"];
if (!numb) {
self.window.rootViewController = firstVC;
[[NSUserDefaults standardUserDefaults]setObject:
[NSNumber numberWithBool:YES] forKey:@"number"];
}
else
self.window.rootViewController = mainVC;
[self.window makeKeyAndVisible];
return YES;
}