LTNavigationBar icon indicating copy to clipboard operation
LTNavigationBar copied to clipboard

由于iOS11导航栏图层改变产生的问题

Open Wangyixuan opened this issue 7 years ago • 3 comments

工程适配iOS 11 调用了lt_setBackgroundColor这个方法 导航栏透明时title和rightBarButtonItem显示正常 滑动页面 导航栏出现时title和rightBarButtonItem被遮挡 因为[self insertSubview:self.overlay atIndex:0];这句代码 使self.overlay出现在NavigationBar的最上层

Wangyixuan avatar Sep 22 '17 08:09 Wangyixuan

same issue :(

huynguyen1991 avatar Sep 25 '17 13:09 huynguyen1991

解决方法:

if (@available(iOS 11.0, *)) { [self.subviews.firstObject insertSubview:self.overlay atIndex:0]; }else{ [self insertSubview:self.overlay atIndex:0]; }

szlsay avatar Sep 27 '17 03:09 szlsay

解决方法:

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);
    }
}

szlsay avatar Sep 27 '17 03:09 szlsay