在我AppDelegate.m
如何登錄Iphone App後重定向到主頁選項卡?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
//Get uer ID from user defaults
NSString *userid = [defaults objectForKey:@"UserId"];
if([userid isEqualToString:@""]){
login = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
[window addSubview:login.view];
} else {
[window addSubview:[rootTabBarController view]];
}
[self.window makeKeyAndVisible];
return YES;
}
後登錄成功,我有這樣的代碼
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:serverOutput forKey:@"UserId"];
//show tabbar app
NewClassMoonAppDelegate * appsDelegate =[[UIApplication sharedApplication] delegate];
[appsDelegate.window addSubview:[appsDelegate.rootTabBarController view]];
這樣的問題是如何可以重定向到特定的標籤[主頁選項卡EXAMBLE]?
對不起,我是初學者在ios ..你可以做更多的討論..我什麼時候可以,但我上面的代碼這行上 –
當你想在當時以編程方式更改tabbar視圖只是寫上面這行.. –