简体   繁体   English

解雇/演示模态视图控制器 - 内存?

[英]Dismiss / Present Modal View Controller - Memory?

When you dismiss a modal view controller is that view controller object destroyed ? 当您解除模态视图控制器时,该视图控制器对象是否被销毁?

Also if you represent the same view controller again does it load from fresh - eg is the "view did load" and "init" method called ? 此外,如果您再次表示相同的视图控制器,它会从新加载 - 例如,“视图是否已加载”和“init”方法被调用?

Releasing objects is your own responsibility, so you should release the view controller yourself, either after calling presentModalViewController, or sometime later (not recommended) 释放对象是你自己的责任,所以你应该在调用presentModalViewController之后或之后的某个时候自己发布视图控制器(不推荐)

For example: 例如:

MyController *controller = [[MyController alloc] init];

[self presentModalViewController:controller animated:YES];

// "controller" is automatically retained, so you can call release right away    

[controller release];

Calling dismissModalViewController later on will release the retained controller automatically. 稍后调用dismissModalViewController将自动释放保留的控制器。

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

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