问题
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