简体   繁体   English

NavigationController和视图层次结构问题

[英]NavigationController and View Hierarchy issue

I have 1 (rootViewController) view controller which is embedded in navigation controller. 我有1(rootViewController)视图控制器,它嵌入在导航控制器中。 Then i pushed another view controller (secondViewController), which has search controller in title view. 然后,我推送了另一个视图控制器(secondViewController),该视图控制器在标题视图中具有搜索控制器。 When i am trying search become first responder (Active) i got this in terminal: 当我尝试搜索成为第一响应者(有效)时,我在终端机上收到了以下信息:

Warning: Attempt to present "AppName.CustomSearchViewController: 0x7face0c20eb0> on whose view is not in the window hierarchy! 警告:尝试显示“ AppName.CustomSearchViewController:0x7face0c20eb0>,其视图不在窗口层次结构中!

This happens only in iOS lower than 11. When i embed this second view controller in navigation controller and present it modally all works good, but i need exactly pushing. 仅在低于11的iOS中会发生这种情况。当我将第二个视图控制器嵌入导航控制器并以模态显示时,一切正常,但是我需要完全推动。 How can i solve this? 我该如何解决?

I solved it! 我解决了! I need to make definesPresentationContext false in rootViewController to make it work on another one! 我需要在rootViewController中将definePresentationContext设置为false,以使其在另一个上运行!

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

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