2011-10-08 62 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你了你的代碼幫助了我。 –

相關問題