LTNavigationBar
LTNavigationBar copied to clipboard
由于iOS11导航栏图层改变产生的问题
工程适配iOS 11 调用了lt_setBackgroundColor这个方法 导航栏透明时title和rightBarButtonItem显示正常 滑动页面 导航栏出现时title和rightBarButtonItem被遮挡 因为[self insertSubview:self.overlay atIndex:0];这句代码 使self.overlay出现在NavigationBar的最上层
same issue :(
解决方法:
if (@available(iOS 11.0, *)) { [self.subviews.firstObject insertSubview:self.overlay atIndex:0]; }else{ [self insertSubview:self.overlay atIndex:0]; }
解决方法:
if (!self.overlay) {
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
if (@available(iOS 11.0, *)) {
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)];
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self.subviews.firstObject insertSubview:self.overlay atIndex:0];
}else{
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)];
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self insertSubview:self.overlay atIndex:0];
}
}else{
if (@available(iOS 11.0, *)) {
self.overlay.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)+20);
}
}