I’m programming for the iPhone and I’m wondering when to use the addSubview method of a view and when to present to use the modal view controller (presentModalViewController). What complicates this even more is if you are using a navigation controller (I’m not) and you can use the pushViewController method?
When would you use each and why?
Thanks.
-presentModalViewControllerand-pushViewControllerare two ways of going about the same thing: displaying a new view. Which you use depends on the user experience you’re going for. They mean different things to the user, but are very similar in implementation.-addSubviewis completely different. It adds components to the current view. You should never use it to display an independent UI.-addSubviewis most often used when programmatically creating the UI in-loadView, though it has many other uses.