0

I have followed this tutorial here.

I have had no problems doing the tab bar but I cant work out how to get the buttons to open up a view or a nib file.

Please could someone give some advice?

The code I have added below:

ViewController.m


- (void)viewDidLoad
{
    [super viewDidLoad];

    self.viewControllers = [NSArray arrayWithObjects:
                            [self viewControllerWithTabTitle:@"Friends" image:[UIImage imageNamed:@"112-group.png"]],
                            [self viewControllerWithTabTitle:@"Challenges" image:[UIImage imageNamed:@"29-heart.png"]],
                            [self viewControllerWithTabTitle:@"Create" image:nil],
                            [self viewControllerWithTabTitle:@"My Photos" image:[UIImage imageNamed:@"news.png"]],
                            [self viewControllerWithTabTitle:@"Profile" image:[UIImage imageNamed:@"123-id-card.png"]], nil];
    [self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil];
}

I hope this helps, I am new to this and its had me confused for a while now.

Thanks

Mike

Kheldar
  • 5,361
  • 3
  • 34
  • 63
SirL0fty
  • 55
  • 1
  • 8
  • 1
    What has me confused is people writing sentences with a dozen verbs, no commas or full stops... and expecting to be understood. Come on, if you want an answer, at least take the time to make yourself readable... Edited for you though. – Kheldar Sep 05 '11 at 12:09
  • http://stackoverflow.com/questions/5406213/adding-tab-bar-view-into-an-existing-table-based-app-iphone this shows you how to add one tab. If you can add one, you can add several :D – Kheldar Sep 05 '11 at 14:13

1 Answers1

0

The UITabBarController (being a container view controller) has an NSArray of viewControllers. You can set these either in code or in the NIB file where you instantiate it.

Cocoanetics
  • 8,171
  • 2
  • 30
  • 57
  • Are you able to expand on this at all? I'm not sure how this is done? Thanks – SirL0fty Sep 05 '11 at 14:11
  • Each tab has a viewController. Each viewController has a view. The viewControllers and views can be created programmatically or in interface builder or a mix of thee two. – ader Sep 05 '11 at 14:26