UINavigationController “back button” custom text?

后端 未结 16 1507
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:30

    Put this into you viewDidLoad, hope it will result into what you are looking for

    UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" 
    style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem = backBarButtonItem;
    [backBarButtonItem release];
    

提交回复
热议问题