views:

16

answers:

1

Hi i m doing this..
-(id)initWithNibName:(NSString*)arg1 bundle:(NSString *)arg2
{
if([super init])
UINavigationController *navController=[[UINavigationController alloc]init];
navController.navigationitem.title=@"Test";
[self.view addSubView:navigationController.view];

}
It is showing NavigationController but without any title.
I want to set the title of NavigationController.
how i wiil get this????????

A: 

The UINavigationController is only a container for other UIViewController. It contains a stack of UIViewControllers that you can push or pop. The title displayed in the navigation bar is the title of the UIViewController that is on the top of the stack (the last pushed UIViewController).

In you sample you did not push any view controller on your UINavigationController. That's why you don't see any title.

The navController.navigationItem.title would be displayed only if your UINavigationController were pushed in another UINavigationController.

See the pushViewController reference. You should also look at the View Controller Programming Guide.

David