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 – FullScreen模态视图控制器显示在表单下方全部内容,希望文章能够帮你解决ios – FullScreen模态视图控制器显示在表单下方所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。