Adding a TabBarController programmatically?

You need to set the tabBarItem and title of the UINavigationController and not its root viewController.

You need to set the tabBarItem and title of the UINavigationController and not its root viewController. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. Self.

Window makeKeyAndVisible; NSMutableArray *tabItems = NSMutableArray alloc initWithCapacity:2; DefaultViewController *dvc = DefaultViewController alloc init; UINavigationController *dvc_nc = UINavigationController alloc initWithRootViewController:dvc; dvc_nc.tabBarItem. Title = @"Default"; dvc_nc.tabBarItem. Image = UIImage imageWithContentsOfFile:NSBundle mainBundle pathForResource:@"Default" ofType:@"png"; tabItems addObject:dvc_nc; dvc release; dvc_nc release; OptionsViewController *ovc = OptionsViewController alloc initWithStyle:UITableViewStyleGrouped; UINavigationController *ovc_nc = UINavigationController alloc initWithRootViewController:ovc; ovc_nc.tabBarItem.

Title = @"Option" ovc_nc.tabBarItem. Image = UIImage imageWithContentsOfFile:NSBundle mainBundle pathForResource:@"Optiomn" ofType:@"png"; tabItems addObject:ovc_nc; ovc release; ovc_nc release; UITabBarController *tbc = UITabBarController alloc init; tbc. ViewControllers = tabItems; self.

TabController = tbc; tabItems release; tbc release; self. Window addSubview:self.tabController. View; return YES; }.

– Mark Sep 6 at 11:58 I've update my post, it will show you how to set the tabBarItem. – rckoenes Sep 6 at 11:59 Now it shows the title correctly, but now when I set the title in the optionsview on "Options" and with your method I init it on "Option", so when the application boots up I see "Default" and "Option". When I click on the TabBar item it changes title to what I configured in viewDidLoad with self.

Title! – Mark Sep 6 at 12:07 Don't set the title in viewDidLoad. – rckoenes Sep 6 at 12:13 Haha, then my navigation bar don't have any title!

I changed it from setting self. Title to self.navigationItem. Title = @"Options";!

Thank you – Mark Sep 6 at 12:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions