如何通过点击其调光视图来关闭UIPresentationController

Ber*_*rnd 2 objective-c uiviewcontroller uikit ios uipresentationcontroller

我用a UIPresentationController来显示自定义模态.演示控制器在显示时具有UIView动画显示的调光视图.模态本身是UIViewController添加到表示控制器的容器中的.

问题

我只能[self dismissViewControllerAnimated:NO completion:nil]从嵌入式UIViewController 调用.但我不能这样做UIPresentationController.但这就是调光视图的地方.

我想避免为模态添加额外的不可见视图或NSNotificationCenter尽可能使用.

如何UIPresentationController通过点击其调光视图来解雇?是否有意义?可能吗?

Ber*_*rnd 5

好的,我找到了.您可以到达显示的UIViewController来解除viaself.presentedViewController

[self.presentedViewController dismissViewControllerAnimated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)