当我尝试从 UIAlertview 按钮显示视图控制器时,我遇到了一个非常奇怪的错误。它在 prsentViewController 行上崩溃了。Backtrace 显示它无法加载视图。我怎样才能解决这个问题?源代码如下:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView == _alertView) {
switch (buttonIndex) {
case 0:
{
[alertView dismissWithClickedButtonIndex:buttonIndex animated:YES];
}
break;
default:
{
NSString *nibName = IS_IPAD? NSStringFromClass([UINewUserAccountViewController class]) : [NSStringFromClass([UINewUserAccountViewController class]) stringByAppendingString:@"~iPhone"];
UINewUserAccountViewController *newUserAccountViewController = [[UINewUserAccountViewController alloc] initWithNibName:nibName bundle:nil];
newUserAccountViewController.delegate = self;
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:newUserAccountViewController];
[self presentViewController:navi animated:YES completion:nil];
}
break;
}
}
}