【发布时间】:2013-09-07 14:51:37
【问题描述】:
我有一个应用程序,其初始场景是带有 3 个选项卡的选项卡栏控制器。我创建了一个 uitabbarcontroller 类并将其设置为该场景 (MainTabViewController)。
在该类中,我从 viewDidAppear 方法调用 presentLogin,该方法显示为:
- (void)presentLogin{
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
if (![prefs stringForKey:@"storedUser"] && ![prefs stringForKey:@"storedPass"]) {
NSLog(@"No user prefs stored");
// BUT WAIT, before all this, lets pop up a view controller for user registration
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
ModalViewController *popupController = [sb instantiateViewControllerWithIdentifier:@"ModalViewController"];
[self presentViewController:popupController animated:YES completion:nil];
} else {
NSString *storedUser = [NSString stringWithFormat:@"User:%@",[prefs stringForKey:@"storedUser"]];
NSString *storedPass = [NSString stringWithFormat:@"User:%@",[prefs stringForKey:@"storedPass"]];
UIAlertView *internetAlert = [[UIAlertView alloc] initWithTitle:storedUser
message:storedPass
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Ok", nil];
[internetAlert show];
}
}
但由于某种原因,modalVC 没有显示。我得到了这个崩溃日志:
Attempting to begin a modal transition from <MainTabViewController: 0xa55d0d0> to <ModalViewController: 0x15e2b5e0> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed
【问题讨论】:
标签: ios uitabbarcontroller modalviewcontroller