我正在Apple iOS开发者网站上做“你的第二个iOS应用程序”教程:https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/SecondiOSAppTutorial/CreatingAddView/CreatingAddView.html#//apple_ref/doc/uid/TP40011318-CH6-SW4
它有一个带有表的MasterViewController,连接到AddSightingViewController,允许用户向表中添加新对象。在MasterViewController中,我必须实现以下方法,当用户在AddSightingViewController中创建对象时,会调用该方法。
- (IBAction)done:(UIStoryboardSegue *)segue
{
if ([[segue identifier] isEqualToString:@"ReturnInput"]) {
AddSightingViewController *addController = [segue sourceViewController];
if (addController.birdSighting) {
[self.dataController addBirdSightingWithSighting:addController.birdSighting];
[[self tableView] reloadData];
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
}
但是当这段代码被调用时,我收到了这个警告:
Warning: Attempt to dismiss from view controller <UINavigationController: 0x8961f10> while a presentation or dismiss is in progress!
我不确定我理解dismissViewControllerAnimated的确切做法。我猜它解散了AddSightViewController,因为用户已经完成了添加一个新对象,但不应该是[addController dissmissViewController .....]或者什么?