ios – FullScreen模态视图控制器显示在表单下方

在根ViewController中,我将全屏呈现模态视图控制器.这在大多数情况下都可以正常工作.我遇到的问题是当另一个Modal ViewController作为表单打开时.发生这种情况时,我的FullScreen VC显示在表单的后面.我该怎么办?

基本上这个“DemoViewController”作为我的应用程序的屏幕保护程序.

demoVideoController = new DemoVideoController(this) { View = { Frame = View.Bounds } };
demoVideoController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
PresentViewController(demoVideoController,false,null);

有任何想法吗?

解决方法

您可以在位于应用程序中所有其他窗口之上的新UIWindow中显示屏幕保护程序视图.例如,像这样(假设您有一个名为screenSaverWindow的UIWindow属性).
- (void)screenSaver
{
    UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
    view.backgroundColor = [UIColor blueColor];
    self.screenSaverWindow = [[UIWindow alloc] initWithFrame:self.view.bounds];
    self.screenSaverWindow.windowLevel = UIWindowLevelAlert + 1;
    [self.screenSaverWindow addSubview:view];
    [self.screenSaverWindow makeKeyAndVisible];

}

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...