简体   繁体   English

UITabBarController中嵌入的UITableView的ios7解除分配

[英]ios7 Deallocation of a UITableView embedded in a UITabBarController

I am just about to submit my first app and I am using Xcode Instruments to perform a memory analysis on my app. 我即将提交我的第一个应用程序,并且我正在使用Xcode Instruments在我的应用程序上执行内存分析。 I can see that once the view is allocated, the memory is not released, despite selecting another view using the TabBarController . 我可以看到,一旦分配了视图,尽管使用TabBarController选择了另一个视图,也不会释放内存。

I have written some code in the function ViewDiddisappear : to set the view to nil. 我在函数ViewDiddisappear编写了一些代码:将视图设置为nil。 From a persistence point of view it is OK. 从持久性的角度来看,这是可以的。 Additionally the memory not in view is released. 此外,不可见的内存将被释放。 However I am not certain if it the best way to release memory not in view. 但是我不确定这是否是释放内存的最佳方法。 One side effect of this method is that when the view is recreated by the selection of the TabBarController , the view ( TableView ) seems to forget that it in a TabBarController with a navigation bar at the top. 此方法的一个副作用是,通过选择TabBarController重新创建视图时,视图( TableView )似乎忘记了它在顶部具有导航栏的TabBarController The view seems shifted up a bit as if it isn't aware of the navigation bar at the top of the screen. 该视图似乎向上移动了一点,好像它不知道屏幕顶部的导航栏一样。

I have been googling about, both in apple documentation and on the web. 在Apple文档和Web上,我一直在搜索。 It isn't clear what is the best way to deallocate a TableViewController when it isn't in view, and any comments on memory allocation when using TabBarController . 目前尚不清楚在不使用TableViewController情况下解除分配的最佳方法是什么,以及在使用TabBarController时是否对内存分配有任何评论。

I would appreciate some expertise to help me get my memory management right before I submit the app. 我将不胜感激一些专业知识,可以帮助我在提交应用程序之前正确地进行内存管理。

thanks 谢谢

Tab bar controller allocates memory for all the view controllers inside it. 标签栏控制器为其中的所有视图控制器分配内存。 You are using iOS 7 and it supports ARC(Automatic Reference Counting). 您使用的是iOS 7,它支持ARC(自动引用计数)。 So, you need not to worry about Tabbar Controller memory. 因此,您不必担心Tabbar Controller内存。

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

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