我有一个问题给你: 我有一套UIViewController附加到self.tabBarController.viewControllers 和我有另一个单独应该是登录scree只出现一次(你第一次打开应用程序),我希望加载,以防万一用户没有登录,否则或之后,用户登录,它会加载我有完整的self.tabBarController.viewControllers。 下面是代码:viewControllers不会出现
-(void)load_login_view{
NSLog(@"map");
UIViewController * fb_login = [[FacebookLoginView alloc]init];
fb_login.title = @"fsf ss";
UINavigationController * fb_login_navigation = [[UINavigationController alloc] initWithRootViewController:fb_login];
[fb_login_navigation.tabBarItem setImage:[UIImage imageNamed:@"eventi.png"]];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL login_status = [defaults objectForKey:@"login_status"];
UIViewController * secondpage = [[SecondViewController alloc]init];
secondpage.title = @"second";
UINavigationController * secondpage_navigation = [[UINavigationController alloc] initWithRootViewController:secondpage];
[secondpage_navigation.tabBarItem setImage:[UIImage imageNamed:@"eventi.png"]];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[secondpage_navigation];
self.window.rootViewController = self.tabBarController;
if(!login_status){
[self load_login_view];
}else{
}
[self.window makeKeyAndVisible];
}