Closed sevenmylove520 closed 4 years ago
tabBar切换,BarButtonItem的space会复原为0
最新版已修复
更新最新版本还是这个状况哦
我在viewDidLoad内创建我的自定义barButtonItem,测试了下,还是会切换时,space变为0
两个页面的自定义barButtonItem的gk_navItemLeftSpace、gk_navItemRightSpace是相等的, if (configure.gk_navItemLeftSpace == self.gk_navItemLeftSpace) { configure.gk_navItemLeftSpace = configure.navItemLeftSpace; }
if (configure.gk_navItemRightSpace == self.gk_navItemRightSpace) { configure.gk_navItemRightSpace = configure.navItemRightSpace; }
你这么判断,是会相等的,也会进入判断中,去赋值
你把viewWIllAppear里面这样改下,然后把viewWillDisappear里面的代码去掉,看看有没有问题
尝试了下,把你GKNavigationBarViewController viewWillDisappear中的代码注释了,并且修改了你图中所说需要修改的地方,还是一样的结果
我这试的没问题啊,你怎么用的,能提供demo?
(void)viewDidLoad {
[super viewDidLoad];
[self configLeftBarButtonItem];
// Do any additional setup after loading the view. }
(void)configLeftBarButtonItem { self.gk_navItemLeftSpace = 11;
UIButton *locationBtn = [UIButton new]; locationBtn.titleLabel.font = DKBoldFont(13); [locationBtn setTitle:@"厦门市" forState:UIControlStateNormal]; [locationBtn setTitleColor:MAIN_TEXT_COLOR forState:UIControlStateNormal]; [locationBtn setImage:[UIImage imageNamed:@"icon_t_location"] forState:UIControlStateNormal]; [locationBtn addTarget:self action:@selector(locationAction:) forControlEvents:UIControlEventTouchUpInside]; //修改图片文字位置及间距 [locationBtn layoutButtonWithEdgeInsetsStyle:DKButtonEdgeInsetsStyleLeft imageTitleSpace:4];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:locationBtn];
self.gk_navLeftBarButtonItem = leftBarButtonItem; }
问题解决了,如果是用pod管理这个库,建议clean后再编辑
gk_navItemRightSpace 设置也不对-1
tabbarController的viewControllers在自定义BarButtonItem时设置了space