Change View Title when Navigating Back from a (Sub) View
I have a RootView with 5 buttons. When a button is pressed, I change the title of the current view (so the Back Button is brief) before displaying the selected view. When transitioning to the new (sub) view, I send the pushViewController message to the NavigationController through the AppDelegate.
When the Back Button is selected in the sub-view, I would like to change the title back to the verbose title.
Could anyone point out how I would accomplish the title change of the RootView when leaving a 开发者_如何学Pythonsub view?
Set the title in viewWillAppear
of you RootView:
- (void)viewWillAppear:(BOOL)animated {
self.title = @"RootView";
}
If you use the back button on a sub-view, the root view will get the right title.
精彩评论