2011-10-08 63 views
1

我将基于窗口的应用程序转换为基于导航的应用程序,但我无法设置导航栏的标题。设置导航控件的标题

controller = [[bookDisplayViewController alloc] initAndCreateView]; 

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller]; 
[email protected]"Application"; 
[window addSubview:nav.view]; 

回答

2

是否有可能为你把

self.navigationItem.title = @"YourName"; 

于另一视角的viewDidLoad中?我会尝试这种方式,看看它是否有效。

1

您必须在UIViewController中设置标题。试试这个:在UINavigationItem


[email protected]"Application"; 

逸岸苹果文档的“标题”属性指出:

 
title 
A localized string that represents the view that this controller manages. 

@property(nonatomic, copy) NSString *title 
Discussion 
Subclasses should set the title to a human-readable string that represents the view to the user. If the receiver is a navigation controller, the default value is the top view controller’s title. 

Availability 
Available in iOS 2.0 and later. 
+0

Thhank你了你的代码帮助了我。 –

相关问题