views:

607

answers:

2

Hi, I have a simple view based application. I want to switch this original view for another view when I push a button on the original view. I do not want to use a navigationviewcontroller, or switchviewcontroller, I simply want to swap the root view for another.

Thanks, Joe

+1  A: 

This isn't recommended by apple. If you have multiple views, you should be using a TabBar controller or a Navigation Controller. One reason is that messages like viewDid/WillAppear don't get sent when you improperly add views.

If you don't want to display a navigation bar, then you you can set it to hidden and no one will ever know the are in a Navigation based app. You can also prevent views from animating in from the side when pushing a view controller.

The other accepted option is loading a "backing" view and never changing it. You can switch out any subviews on this backing view. You might never see the backing view in the app, but it is there just for you to remove and add views.

Corey Floyd
A: 

More or less a duplicate of this SO question.

Roger Nolan