2011-09-16 49 views

回答

2

如果你不介意有相同的標題時,它也是在橫向模式下(不彈出),然後在RootViewControllerviewDidLoad方法,你可以這樣做:

self.title = @"Title Here"; 

或IB:

  • 開放的MainWindow.xib
  • 雙擊拆分視圖控制器
  • 點擊導航欄(它說:「根視圖控制器上「)
  • 在導航項屬性檢查器,您可以通過在willHideViewController添加代碼輸入新的標題


如果你想在景觀一個標題,另一個用於彈出,是可以做的,並willShowViewController委託方法。在標準拆分視圖模板中,這些在DetailViewController中實現。

的代碼是(假設左側視圖控制器是一個導航控制器就像在模板):

//in willHideViewController: 
((UINavigationController *)aViewController).topViewController.title 
    = @"Title For Popup Mode"; 

//in willShowViewController: 
((UINavigationController *)aViewController).topViewController.title 
    = @"Title For Landscape Mode"; 
+0

謝謝,真是棒極了! – lascoff