我使用下面的代碼解僱模式視圖控制器:dismissModalViewControllerAnimated在IOS崩潰6.0的iPad模擬器
- (IBAction)done {
#ifdef __IPHONE_5_0
if ([self respondsToSelector:@selector(presentingViewController)])
[self.presentingViewController dismissModalViewControllerAnimated:YES];
else
#endif
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
如果我欠幅脈衝模擬器,他使用的iOS 4.3的iPad,它採用self.parentViewController
和工作正常。但是,當我使用iOS 6.0 iPad模擬器時,模擬器在使用self.presentingViewController
解除視圖後立即崩潰。
我沒有真正的iPad來測試......任何想法?
編輯:
下面是創建模態視圖控制器的代碼。
NSArray* errors = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Errors" ofType:@"plist"]];
UIViewController* vc;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
DocumentsViewController_iPad* docsVC = [[DocumentsViewController_iPad alloc] initWithNibName:@"DocumentsViewController-iPad" bundle:nil];
docsVC.documents = errors;
docsVC.errors = YES;
docsVC.navTitle = @"Troubleshooting";
vc = docsVC;
} else {
DocumentsViewController* docsVC = [[DocumentsViewController alloc] initWithNibName:nil bundle:nil];
docsVC.documents = errors;
docsVC.errors = YES;
docsVC.navTitle = @"Troubleshooting";
vc = docsVC;
}
vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:vc animated:YES];
[vc release];
爲什麼會反對票? – Mausimo