Hi,
I have some troubles to understand this concept.
I need to use a UINavigationController and a UITabBarController for my App.
I think I have some confusions about the Controller notions.
By reading the chapter 7, I have no problem to add my TabBarItems.
But how can I have in the same time a navigation Item?
This is what I did.
From the appDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
tabBarController = [[UITabBarController alloc] init];
UIViewController *vc1 =[[RechercheViewController alloc] init];
NSArray *viewControllers =[NSArray arrayWithObjects:vc1,nil];
[vc1 release];
[tabBarController setViewControllers:viewControllers];
UINavigationController *navController =[[UINavigationController alloc] initWithRootViewController:tabBarController];
[window addSubview:[navController view]];
[window makeKeyAndVisible];
return YES;
}
I get my TabBar as well as my Navigation bar. I don’t know if it’s the good way.
Then, from my viewController,
I wrote this, but the title is not displayed on the NavigationItem.
-(id)init
{
[super initWithNibName:nil bundle:nil];
UITabBarItem *tbi =[self tabBarItem];
[tbi setTitle:@"Search"];
[[self navigationItem] setTitle:@"Search"];
return self;
}
-(id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
{
return [self init];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
Do I miss something?
Stan