美文网首页
iOS 10 UINavigationBar+Awesome B

iOS 10 UINavigationBar+Awesome B

作者: shier | 来源:发表于2016-09-18 14:45 被阅读318次

升级iOS10,发现view位置调到上面去了,坑死人不偿命。

这里异步再修改下位置即可。

解决方案:

- (void)lt_setBackgroundColor:(UIColor *)backgroundColor

{

if (!self.overlay) {

[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

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];

}

self.overlay.backgroundColor = backgroundColor;

// fix iOS 10 重要重要重要重要重要重要重要重要重要

dispatch_async(dispatch_get_main_queue(), ^{

[self insertSubview:self.overlay atIndex:0];

});

}

相关文章

网友评论

      本文标题:iOS 10 UINavigationBar+Awesome B

      本文链接:https://www.haomeiwen.com/subject/lxfgettx.html