What is the difference between addSubview, pushViewController and presentModalViewController?

Can someone explain to me what's the difference in using those methods?
I've read the Apple documentation but I still don't get it.

Posted on Jun 26, 2011 6:06 AM

Reply
1 reply

Jun 27, 2011 7:11 AM in response to Wikiboo

addSubview is a lower level feature, which you use to add additional views to your parent/main view. pushViewController replaces the current main view in your window with the view associated with the new view controller. You use presentModalViewController when you want to display a view modally (blocks previous view) on top of your current view. If you use full screen for your modal view controller, there is not too much difference between pushViewController and this in terms how the UI behaves. When you use pushViewController you can "pop" to any view controller in the array of view controllers that have been pushed, which is not as easy to do with nested modal views.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

What is the difference between addSubview, pushViewController and presentModalViewController?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.