开发者

title of navigationController

-(id)initWithNibName:(NSString*)arg1 bundle:(NSString *)arg2

{

if([super init])

UINavigationController *navController=[[UINavigationController alloc]init];

navController.navigationitem.开发者_JAVA技巧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????????


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜