OGeek|极客世界-中国程序员成长平台

标题: iphone - 从 subview 中关闭 ModalViewController [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 20:07
标题: iphone - 从 subview 中关闭 ModalViewController

函数调用有问题:

[self dismissModalViewControllerAnimated:YES];

在 MainViewController 中,我可以启动一个图像选择器并像往常一样通过单击取消按钮来关闭。

(IBAction) LaunchInMainid)sender{

    MainAppDelegate *app = (MainAppDelegate *)[[UIApplication sharedApplication] delegate];

    //elcPicker is a customized image picker
    [app.viewController presentModalViewController:elcPicker animated:YES];
    [elcPicker release];
    [albumController release];

- (void)elcImagePickerControllerDidCancelELCImagePickerController *)picker {
    [self dismissModalViewControllerAnimated:YES];
}

现在,我不是直接在 Main 中启动它,而是先添加一个 subview ,然后使用相同的启动方法从 subview 启动图像选择器。

问题:

无法关闭图像选择器并且无法再次显示 subview 。所以无论我点击什么,屏幕都将保留在图像选择器中。

我一直在尝试其他一些电话,例如没有任何成功:

[self dismissModalViewControllerAnimated:YES];

我对任何帮助或想法都很满意。如果您认为应该提供更多信息,我可以添加更多代码。



Best Answer-推荐答案


可以试试

[app.viewControllerdismissModalViewControllerAnimated:YES];

希望这会有所帮助。

关于iphone - 从 subview 中关闭 ModalViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10101259/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4