关于根据条件选择Storyboard,我之前的一篇文章,今天使用的时候,不起作用了,悲剧,今天又自己写了一个。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//主要的storyboard - xunYi7TabBarViewController
//login的storyboard - login

UIViewController *rootViewController;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
if([[NSUserDefaults standardUserDefaults] boolForKey:@"logged_in"]) {

rootViewController = [[UIStoryboard
storyboardWithName:@"MainStoryboard" bundle:nil]
instantiateViewControllerWithIdentifier:@"xunYi7TabBarViewController"];
}else{

rootViewController = [[UIStoryboard
storyboardWithName:@"LoginStoryboard" bundle:nil]
instantiateViewControllerWithIdentifier:@"login"];
}
self.window.rootViewController=rootViewController;

[self.window makeKeyAndVisible];
return yes;

如果这个例子不起作用,也可以尝试我之前的那篇文章iOS启动 判断使用不同的 storyboard