shox
shox

Reputation: 1160

How to group set of controllers in xcode

I am new iphone developer with experiences in web development , and now i try to build tabs in a controller , in HTML i use div to group set of controllers so I can hide or display it through JavaScript , how i can achieve the same thing in xcode ( interface builder ) ?

Upvotes: 1

Views: 116

Answers (1)

Stas
Stas

Reputation: 9935

I think you should use a TabBar controller. Try to implement the code like this:

  myTabBarController = [[UITabBarController alloc] init];
  NewsFeedController *newsFeedController = [[NewsFeedController alloc] initWithFacebook:facebook];
  UINavigationController *navigationControllerHome = [[UINavigationController alloc] initWithRootViewController:newsFeedController];
  [newsFeedController release];
  AboutController *aboutController = [[AboutController alloc] init];
  UINavigationController *navigationControllerAbout = [[UINavigationController alloc] initWithRootViewController:aboutController];
  [aboutController release];
  myTabBarController.viewControllers = [NSArray arrayWithObjects:navigationControllerHome, navigationControllerAbout, nil];
  [self.window addSubview:myTabBarController.view];

The NewsFeedController and AboutController will appear in tabs

Upvotes: 1

Related Questions