LTNavigationBar icon indicating copy to clipboard operation
LTNavigationBar copied to clipboard

ios10适配

Open al1020119 opened this issue 7 years ago • 4 comments

如果导航栏设置了透明的话,iOS10上面导航栏完全是是白色的标题也看不清。

al1020119 avatar Sep 05 '16 05:09 al1020119

我目前也遇到这个问题啊,求解!

iHTCboy avatar Sep 09 '16 09:09 iHTCboy

https://github.com/ltebean/LTNavigationBar/issues/37

langhua9527 avatar Sep 11 '16 06:09 langhua9527

在 #37 还是不能解决问题。

我的是自定义一个naviBar,默认是不显示背影,上拉后淡出。 我的解决方法:

if (IS_iOS10) {
    naviBar.translucent = YES;
    [naviBar lt_setBackgroundColor:[UIColor clearColor]];
}

文件UINavigationBar+Awesome.h 里面的方法lt_setBackgroundColor 要是下面的:

- (void)lt_setBackgroundColor:(UIColor *)backgroundColor
{
    if (!self.overlay) {
        [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
        self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
        self.overlay.userInteractionEnabled = NO;
        self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
        [self insertSubview:self.overlay atIndex:0];
    }
    self.overlay.backgroundColor = backgroundColor;
}

@al1020119

iHTCboy avatar Sep 12 '16 03:09 iHTCboy

issues里有人提过这个问题,据说新版v2.1.7解决了,不过我这边尝试透明时还是显示白色。 后来仿照了美团app,直接隐藏了_UINavigationBarBackground(iOS9)或_UIBarBackground(iOS10)这个view,背景自然就透明了,然后自定义了个view,放在导航栏下面,通过设置view的背景色来达到每个控制器导航栏颜色不同的需求。

zwind007 avatar Sep 14 '16 08:09 zwind007