1

UINavigationBar の [戻る] ボタンはビュー コントローラーのタイトルをタイトルとして使用しているように見えます。前のビュー コントローラーにタイトルがない場合は [戻る] を使用しますが、タイトルに関係なく戻るボタンのタイトルをカスタマイズする方法はありますか以前のView Controllerは?

ありがとう

4

1 に答える 1

5

You need to create your own bar button item and assign it to the previous view controller navigationItem backBarButtonItem property, for example:

UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] init];
temporaryBarButtonItem.title = NSLocalizedString(@"MAIN", @"Back bar button item to go back to the main view controller");
self.navigationItem.backBarButtonItem = temporaryBarButtonItem;

Check the UINavigationItem class reference to make sure you put the codes above in the correct view controller, especially this part:

When this navigation item is immediately below the top item in the stack, the navigation controller derives the back button for the navigation bar from this navigation item.

于 2013-07-08T00:29:03.053 に答える