开发者

popToRootViewControllerAnimated and dealloc all views

I have a UINavigationController that asks for some information and the user navigates until the end, once there, they can Accept or Cancel all the data that has been entered.

It doesn't matter wich option they choose, as they always will go to the first view using

[UINavigationController popToRootViewControllerAnimated:] 

The question is, how I can release/deallocate all开发者_Go百科 the views ?

For example, they start for view 1 and the end is at view 8, once they go directly to the 1 from the 8, how I can release view 2,3,4,5,6,7,8 ?

thanks,

regards,

m.


Just allow navigation controller to handle memory for you - it retains controller pushed to its stack and releases them on remove. So if you do not take ownership of your controllers anywhere else they will be deallocated automatically after popped from navigation controller. Basically you should push controllers as follows:

SomeControllerType* controller = [[SomeControllerType alloc] init];
[navigationController pushViewController:controller animated:animated];
[controller release]; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜