UINavigationController “back button” custom text?

后端 未结 16 1496
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:31

    From this link:

    self.navigationItem.backBarButtonItem =
       [[UIBarButtonItem alloc] initWithTitle:@"Custom Title"
                style:UIBarButtonItemStylePlain
               target:nil
               action:nil];
    

    As Tyler said in the comments:

    don't do this in the visible view controller, but in the view controller that you'd see if you hit the back button

提交回复
热议问题