Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I dont have XCode on hand so i will try to answer verbally.</p> <p>Create a new <code>UITabBarController</code> and set your current view as the <code>root view</code>, then add as much tabs as you want, (each tab has its own view).</p> <p><strong>UPDATE</strong><br> After init'ing the controller, define an array of views (order of adding is important). And call this on the tab bar controller</p> <pre><code>- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated </code></pre> <p><strong>UPDATE 2</strong> </p> <p>Here is a simple code to create a tab bar with two empty views, each has its own tab button.</p> <pre><code>tabBarController = [[UITabBarController alloc]init]; firstView = [[FirstView alloc] init]; UITabBarItem *item1 = [[[UITabBarItem alloc]initWithTitle:@"First" image:nil tag:1] autorelease]; [firstView setTabBarItem:item1]; secondView = [[SecondView alloc] init]; UITabBarItem *item2 = [[[UITabBarItem alloc]initWithTitle:@"Sec" image:nil tag:1] autorelease]; [secondView setTabBarItem:item2]; [tabBarController setViewControllers:[NSArray arrayWithObjects:firstView,secondView,nil] animated:NO]; [window addSubview:tabBarController.view]; </code></pre> <p>Of course this code wont be useful as is, you will need to create the views manually, or create a nib file for each view and load it in <code>initWithNibName</code></p> <p><strong>UPDATE 3</strong><br> Check this <a href="http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.3124430053.03124430055" rel="nofollow noreferrer">Stanford iPhone Course</a>, its a free course from Stanford univ. the lecturers are Apple employees. Lecture 7 titled <strong>Navigation &amp; Tab Bar Controllers</strong> will give you a good start on those components.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload