首页 > 解决方案 > 关闭从不同方法呈现的视图控制器

问题描述

我正在尝试使用一种方法呈现自定义 UIViewController 并从另一种方法中关闭相同的 UIViewController。

用于呈现控制器的方法:

-(void)presentViewController {
    self.customView = [[UIViewController alloc] init];
    [self.customView setModalPresentationStyle: UIModalPresentationOverFullScreen];
    [self presentViewController:self.customView animated:YES completion:nil];
}

用于关闭控制器的方法:

-(void)dismissViewController {
    [self.customView dismissViewControllerAnimated:YES completion:nil];
}

在 my 中创建一个customView调用的按钮时dismissViewController,没有任何反应。我知道该方法被调用是因为completion:标签正在工作,但视觉上没有任何反应。也没有错误被打印到控制台。

也许我做错了整件事,但感谢任何帮助!只是想学习。

标签: iosobjective-ciphoneuiviewcontroller

解决方案


推荐阅读