views:

41

answers:

1

Trying to wrap my head around the apple design scheme. I have a UIViewController and the corresponding XIB file that has my main screen in my application. I want to have a button on this XIB that displays another "form" (this is my disconnect) in the foreground where the user selects from a myriad of choices, then it hides that "form" and goes back to the first one.

I'm completely lost here. Initially I thought I'd just add another view and set the self.view of my controller to the new view, add another IBAction and call it a day, but I can't seem to make that work. For sake of argument, say I want to "gray out" the current form, have a modal type window that takes up roughly 60% of the screen and requires you select an option, then it hides itself and we go back to normal. What is the standard approach here?

Thanks

+1  A: 

Your ViewController does what's its name indicates; controls a UIView. If you have an additional view for your form, you can just add it to the ViewController's view:

[self.view addSubview:yourFormUIView];

This will add your new view to the view that is (essentially) in the the related .xib file. You might also want to check out modal view controllers istead.

Typeoneerror