iOS 7 backBarButtonItem hidden

两盒软妹~` 提交于 2019-12-10 13:14:32

问题


I've an issue with back bar button. It stay hidden no matter that i do like self.navigationItem.hidesBackButton

Here is my code to add back button:

//
    - (void)viewDidLoad{

    [.....];

    UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"UI_BTN_BACK", nil) style:UIBarButtonItemStylePlain target:nil action:nil];
    back.tintColor = [Templates getColor:@"color"];
    [[self navigationItem] setBackBarButtonItem:back];

    // Parent
    [super viewDidLoad];
}

Button stay hidden BUT going back works if if touch on the place where it should be. Of course it works on iOS6. Another detail: back button seems to appear when i set UINavigationBar translucent to YES.

Thanks


回答1:


Use this code:

self.navigationItem.backBarButtonItem = nil;

OR

self.navigationItem.leftBarButtonItem = nil;



回答2:


[self.navigationItem setHidesBackButton:YES];

Check out this.




回答3:


self.navigationController.navigationBar.tintColor = [UIColor whiteColor];


来源:https://stackoverflow.com/questions/18955730/ios-7-backbarbuttonitem-hidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!