简体   繁体   English

无法通过显示的视图控制器访问TopView

[英]TopView is not accessible from presented view controllers

I am having a view which is added to UIApplication.keyWindow to make it visible to all viewControllers. 我有一个添加到UIApplication.keyWindow的视图,以使其对所有viewControllers可见。 But this view is not accessible when some controller is presented and over it another controller is presented. 但是,当显示某个控制器并在其上显示另一个控制器时,此视图不可访问。 The above said view is not accessible from second presented controller. 不能从第二个呈现的控制器访问上述视图。

I am using this code UIApplication.shared.keyWindow.addSubView(myView). 我正在使用此代码UIApplication.shared.keyWindow.addSubView(myView)。

So how can i made my view accessible from here. 因此,我该如何从这里访问我的视图。

I have shared two images here. 我在这里分享了两张图片。 One is normal and another one view debugging. 一种是正常的,另一种是调试的。

Image1 Image2 图片1图片 2

只需将代码UIApplication.shared.keyWindow.addSubView(myView)放入viewDidAppear中,即可解决上述问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM