简体   繁体   中英

Memory issue in Present Modal View Controller

I am just presenting modal view controllers one after the another and not dismissing that. Because my requirement is such that I want show view controllers one after the another like chain. 1) Will this create memory problem ? 2) If so what is the work around ? Thanx in advance

Yes you may get a memory or performance problem. I don't think Apple intended/intends for anyone to present multiple modal view controllers one after the other.

Have you seen this : Problem dismissing multiple modal view controllers

I think you should dismiss the current modal before presenting a new one. Always. Always. Always. You don't have to dismiss them animated though, you can dismiss them without animation so you don't see them disappear visually.

If you need to be able to go backwards through the chain of modally presented view controllers then I would instigate a method for doing this. eg add properties to your UIViewController subclasses that specify the next and previous viewController (or maintain a history trail of the viewControllers).

To be honest, it sounds like you should be using a navigationController and not presenting the viewControllers modally.

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