当我第一次点击它显示自定义左栏按钮时,我遇到了自定义LeftBarButtonItem的问题,但在第二次它被隐藏了!这个问题只出现在ios 11中,但是在ios10中它运行得很好。
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];
}
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
.....
}
请帮助