我有一個問題給你: 我有一套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];
}