简体   繁体   English

活动时,UISearchController不会从内存中释放

[英]UISearchController does not get released from memory when Active

I have a UISearchController in my application which is active. 我的应用程序中有一个UISearchController处于活动状态。 Now the ParentController which is showing the search controller gets popped from button action inside the controller. 现在显示搜索控制器的ParentController从控制器内部的按钮动作中弹出。

Now what is happening is that the due to this search controller, the parent controller is not getting released from the memory. 现在发生的是由于该搜索控制器,父控制器没有从内存中释放。 Any suggestions how to handle this scenario 关于如何处理这种情况的任何建议

I have to set self.searchController.active = false; 我必须设置self.searchController.active = false; everytime i have to pop. 每次我必须弹出。

Usual scenario is where a child VC has an unneeded reference to the parent and does not specify this to be weak. 通常的情况是,子级VC不需要引用父级,并且没有将其指定为弱值。 Therefore, a retain cycle appears where the parent retains the child and the child retains the parent so none of them are actually released. 因此,出现了一个保留周期,其中父母保留了孩子,而孩子保留了父母,因此实际上都没有释放他们。

This might be your case as well. 这也可能是您的情况。

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

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