I’m trying to avoid using Interface Builder as much as possible.
At the moment I have the view controller created via code and change views via code as well.
I now need one of the steps to send the app into a new view with a tab bar, that will allow me to change views as well.
Ideally, what I’d do is tell the current view controller to add a Tab Bar to the bottom, but I’m not sure if that’s doable, so I might have to swap the UIViewController with a UITabBarController?
Any help will be appreciated.
Cheers,
Andre
I don’t have Xcode on hand so I will try to answer verbally.
Create a new
UITabBarControllerand set your current view as theroot view, then add as much tabs as you want, (each tab has its own view).UPDATE
After init’ing the controller, define an array of views (order of adding is important). And call this on the tab bar controller
UPDATE 2
Here is a simple code to create a tab bar with two empty views, each has its own tab button.
Of course this code won’t be useful as is, you will need to create the views manually, or create a nib file for each view and load it in
initWithNibNameUPDATE 3
Check this Stanford iPhone Course, it’s a free course from Stanford univ. the lecturers are Apple employees. Lecture 7 titled Navigation & Tab Bar Controllers will give you a good start on those components.