Back button not made on navigation bar

后端 未结 1 1665
时光取名叫无心
时光取名叫无心 2021-01-23 10:45

I started out with a navigation based project and am pushing further views onto the controller. The problem is that if I do not give a title to the navigation item then the back

1条回答
  •  悲哀的现实
    2021-01-23 11:28

    Just create the back button yourself:

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

    (If you prefer dot notation, self.navigationItem.backBarButtonItem = back;)

    0 讨论(0)
提交回复
热议问题