Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不知道原来作者去什么地方了,现在显示不出来的可以这样解决的 #37

Open
langhua9527 opened this issue Jul 14, 2016 · 2 comments

Comments

@langhua9527
Copy link

langhua9527 commented Jul 14, 2016

把这个文件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;
}

因为返回回来之后self.overlay就跑最上面一层去了,并没有在最后面,所以就挡到了,显示不出来了
每次这样手动处理一下就好了

@langhua9527
Copy link
Author

`- (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.overlay.backgroundColor = backgroundColor;
dispatch_async(dispatch_get_main_queue(), ^{
    [self insertSubview:self.overlay atIndex:0];
});

}`

just try it , i fix it

@yhjiang
Copy link

yhjiang commented Dec 27, 2016

- (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.overlay.backgroundColor = backgroundColor;
    dispatch_async(dispatch_get_main_queue(), ^{
        [self insertSubview:self.overlay atIndex:0];
    });
}

楼上的这个方法亲测可以解决,我iOS10.2系统 xcode8.2跑的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants