How would one change the view on the screen programmatically in an iPhone app?
I’ve been able to create navigation view’s and programmatically push/pop them to produce this behaviour, but if I wanted to simply change the current view (not using a UINavigation controller object), what is the neatest way to achieve this?
A simple example, imagine an application with a single button, when pressed will display a new view, or possibly one of multiple views depending on some internal state variable.
I have yet to see any examples that attempt to do this, and I don’t seem to understand enough about the relationships and initialisation procedure between UIViewController/UIView objects to achieve this programmatically.
I use
presentModalViewController:animated:to bring up a settings view from my main window’sUIViewControllerand then when the user presses ‘done’ in the settings view I calldismissModalViewControllerAnimated:from the settings view (reaching back to the parent view) like this: