custom leftbarbuttonItem not showed in ios 11

送分小仙女□ 提交于 2019-12-11 06:53:44

问题


i had a problem with a custom LeftBarButtonItem when i clicked for the first time it showed the custom leftbarbutton but in the second time it's hidden !!!! this problem appear only in the ios 11 but in ios10 it's worked perfectly.

Class A:
- (void)setBackButton {
    if (_backTabBarItem == nil) {
        UIButton *backButton     = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
        [backButton setImage:[UIImage  imageNamed:@"icon_back"] forState:UIControlStateNormal];
        [backButton setTitleColor:[UIColor white] forState:UIControlStateNormal];
        [backButton addTarget:self action:@selector(popViewController) forControlEvents:UIControlEventTouchUpInside];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    }
    [self.navigationItem setLeftBarButtonItem:_backTabBarItem animated:NO];
}

in class B:

func showLisHikeViewController(actionView: ActionView) {
        let listHikeController = EMListHikeViewController.sharedManager() as! EMListHikeViewController

        let leftButton = UIBarButtonItem(image: UIImage(named:"ic_slide"),style : .plain, target: self, action: #selector(EMSlideMenu.leftButtonAction)) //Use a selector
        listHikeController.backTabBarItem = leftButton
.....
}

Any help please

来源:https://stackoverflow.com/questions/48564480/custom-leftbarbuttonitem-not-showed-in-ios-11

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