ipad SplitView title on popup
How do you change the the title on the popup window in a split-view project? It currently says "Root View Contr开发者_如何学Pythonoller" in a split-view project?
If you don't mind having the same title when it's also in landscape mode (no popup), then in the viewDidLoad
method of RootViewController
, you can do:
self.title = @"Title Here";
or in IB:
- open MainWindow.xib
- double-click the Split View Controller
- click on the navigation bar (where it says "Root View Controller")
- in the Navigation Item Attributes Inspector, you can enter a new title
If you want one title in landscape and another for the popup, that can be done by adding code in the willHideViewController
and willShowViewController
delegate methods. In the standard split view template, these are implemented in DetailViewController
.
The code would be (assuming the left side view controller is a navigation controller like in the template):
//in willHideViewController:
((UINavigationController *)aViewController).topViewController.title
= @"Title For Popup Mode";
//in willShowViewController:
((UINavigationController *)aViewController).topViewController.title
= @"Title For Landscape Mode";
精彩评论