views:

45

answers:

3

Hello!

I'm confused something fierce over having multiple views. I simply want to have a button on my main view that activates a new view, which in turn would have an (x) button which goes back to main view. For the life of me, I can't figure out how to do this with two separate .xib files. How might this be done?

Thanks!

+1  A: 

It might be easiest to just use the utility application as a template.

From there, you can see how you would load view controllers and nibs in order to bring up the new view followed by how you would exit it.

Jacob
I have been studying it to no avail. Oh well, time to go back to the books. ;)
willingfamily
On the utility application, take a special look at the - (IBAction)showInfo:(id)sender function on MainViewController and then - (IBAction)done:(id)sender on FlipsideViewcontroller
Jacob
Will do, thanks!
willingfamily
A: 

You are using a navigation controller, right?

On the IBAction associated with a button tap on the main view, put

NewViewController *newView = ... // [alloc - init your view here if you haven't already]
[self.navigationController pushViewController:newView animated:YES];

And on the button on newView,

[self.navigationController popViewControllerAnimated:YES]
Altealice
No it's actually not a navigation controller.
willingfamily