UINavigationController “back button” custom text?

后端 未结 16 1489
Happy的楠姐
Happy的楠姐 2020-11-28 01:41

The \"back button\" of a UINavigationController by default shows the title of the last view in the stack. Is there a way to have custom text in the back button

16条回答
  •  臣服心动
    2020-11-28 02:28

    - (void)viewDidLoad {
      [super viewDidLoad];
    
      UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
      self.navigationItem.backBarButtonItem = backButton;
      [backButton release];
    }
    

提交回复
热议问题