Create a custom left back button on UINavigationBar WITH the standard arrow on the left

后端 未结 6 1605
情书的邮戳
情书的邮戳 2021-02-05 03:27

When I create a custom back button, I use the following code:

    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc]initWithTitle:@\"Yeah\" style:UIBarButton         


        
6条回答
  •  抹茶落季
    2021-02-05 04:09

    well you need to go with a background image and with title and

    // Creates a back button instead of default behaviour (displaying title of previous screen)
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back_arrow.png"]
                                                                   style:UIBarButtonItemStyleBordered
                                                                  target:self
                                                                  action:@selector(backAction)];
    
    tipsDetailViewController.navigationItem.leftBarButtonItem = backButton;
    [backButton release];
    

提交回复
热议问题