Reputation: 7370
I'm busy design a UI for an app that I am making. The UI will have a few UITextField
boxes where the user fills in the info. Then, they would hit next and go to another screen for additional info that is related to the first screen.
Now I wanted to approach this like so:
In storyboard have the two or three screen with UITextField
and other small UI stuff. However these three screens share the same viewController
class as their "job" is the same job.
Would this be a good way to go about it?
I just don't want three viewController
classes for the same "job" that seems messy to me.
Upvotes: 0
Views: 953
Reputation: 2267
Create UIView with Xib for various form. Then when ever necessary create corresponding UIView and Add it as subview to ViewController main view with simple animation. When you don't need it simply remove or hide(When need in future) from the current ViewController.
Upvotes: 1
Reputation: 392
just call
[self viewWillAppear:YES];
and in your
- (void) viewWillAppear:(BOOL)animated
{
//set the views according to your need for each case
}
Upvotes: 1
Reputation: 1269
Not sure my solution fits you. You can create three controllers in storyboard but one controller in your code. Then you set the class type of the three controllers to the same controller of your code.
However I have never done this before. I will have three controllers if I were you.
Upvotes: 1