简体   繁体   中英

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 ?

Releasing objects is your own responsibility, so you should release the view controller yourself, either after calling presentModalViewController, or sometime later (not recommended)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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