I have a UISearchController
in my application which is active. Now the ParentController which is showing the search controller gets popped from button action inside the controller.
我的应用程序中有一个UISearchController是活动的。现在显示搜索控制器的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;
everytime i have to pop.
我需要设置self。searchcontroller。积极= false;每次我都要跳。
1 个解决方案
#1
0
Usual scenario is where a child VC has an unneeded reference to the parent and does not specify this to be weak. Therefore, a retain cycle appears where the parent retains the child and the child retains the parent so none of them are actually released.
通常情况下,子VC对父VC有一个不需要的引用,并且没有指定它是弱引用。因此,当父元素保留子元素而子元素保留父元素时,就会出现一个保留循环,这样它们就不会被释放了。
This might be your case as well.
这也可能是你的情况。
#1
0
Usual scenario is where a child VC has an unneeded reference to the parent and does not specify this to be weak. Therefore, a retain cycle appears where the parent retains the child and the child retains the parent so none of them are actually released.
通常情况下,子VC对父VC有一个不需要的引用,并且没有指定它是弱引用。因此,当父元素保留子元素而子元素保留父元素时,就会出现一个保留循环,这样它们就不会被释放了。
This might be your case as well.
这也可能是你的情况。