【发布时间】:2014-07-29 23:07:15
【问题描述】:
我的 unwind segue 代码运行良好。我使用故事板来连接事情。当我运行该应用程序时,一切都很好。
但除了单击按钮之外,我还想从代码中展开。基本上,我展示了一个包含两个按钮的模式:Camera、Gallery。用户单击其中一个按钮以从相机或图库中获取图像。所以一旦获得图像,我就不再需要模态视图了。因此,作为 (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 方法的最后一步,我将我的 unwind segue 称为
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
//... do work here and then
[self performSegueWithIdentifier:@"myUnwindName" sender:self];
}
但是当我这样做时,我收到以下错误
attempt to dismiss modal view controller whose view does not currently appear.
self = <UITabBarController: 0x127d09b80> modalViewController = <UIImagePickerController: 0x127e2fd80>
我理解这个问题。但我不知道如何解决它。
基本上,我不应该在“相机视图”仍在屏幕上时拨打电话(即我的模态还没有在屏幕上)。但是我在哪里打电话呢?有没有像ImagePickerDidClose 这样的东西或类似的东西?我找不到一个。非常感谢您的帮助。
【问题讨论】:
标签: ios objective-c modal-dialog uiimagepickercontroller segue