Derek
Derek

Reputation: 67

What is the cleanest and best way to switch views?

I've seen a lot of posts and videos on switching views and many of them have vastly different approaches. Some swap the entire view (via a delegate class), some use presentModalViewController:animated:, etc.

So I ask: what is the best, cleanest, and most memory-friendly way to switch views? (I use view switching as a way to show completely new information that might be on the screen for a long time, not a temporary notice.)

Thanks, Derek

Upvotes: 0

Views: 112

Answers (1)

joelm
joelm

Reputation: 8771

There is no one answer to this question. It depends on the structure of your application, the UI you want to present and how you want the transition to look to the user. In terms of memory, what you do with the old view is more important than how you present the new view.
For example, if your root view switches (occasionally) between two other views, you can present them modally, or with a navigation controller, but when one is not displayed you might want to release/destroy it to save resources. (Actually, if you might switch back, you can keep the non-displayed view around and only release it if you get a memory warning.)

Upvotes: 1

Related Questions