0
嗨我試圖改變tabcontroller流量,所以當一個用戶沒有在只是把他帶到登錄視圖而不是設置之一。我的控制器擴展TabBarController和我設置的委託作爲TabBarController,覆蓋shouldSelectViewController做一個segue
self.tabBarController.delegate=self;
我的代碼是:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if (login) {
LoginViewController *loginViewController = [[LoginViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:loginViewController];
[tabBarController presentViewController:loginViewController animated:YES completion:nil];
return NO;
} else {
return YES;
}
我從來沒有設法做導航它提供了一個EXCETION:
ion 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <UITabBarController: 0x6a72220>.
我也嘗試過以模式顯示登錄,但僅顯示黑屏:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if (YES) {
LoginViewController *loginViewController = [[LoginViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:loginViewController];
[tabBarController presentModalViewController:navController animated:YES];
return NO;
} else {
return YES;
}
}
任何人都可以幫助我!!!!請!!!!
這並沒有對iPhone爲我工作。我必須執行以下操作:將modalPresentationStyle設置爲UIModalPresentationFormSheet,並將modalTransitionStyle設置爲UIModalTransitionStyleCrossDissolve。 – 2012-11-07 23:50:41