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

黑名单无效 #145

Closed
dong136279559 opened this issue Jul 11, 2018 · 13 comments
Closed

黑名单无效 #145

dong136279559 opened this issue Jul 11, 2018 · 13 comments

Comments

@dong136279559
Copy link

demo 也有这个问题 如下图 :
099847d7df6ba2e0317413800a3c823b
abcbd7579b9636a4256f1dc977467e2c

@banchichen
Copy link

banchichen commented Jul 30, 2018

作者你好,我这边也发现该库和TZImagePickerController一起使用时有这个问题,我做了如下改动修复了黑名单失效问题,供参考哈:
1、在readme的基础之上,把TZImagePickerController也加入到黑名单中
2、在WRNavigationBar的updateNavigationBarWithFromVC:toVC:progress:方法最前面,加上如下判断:

- (void)updateNavigationBarWithFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC progress:(CGFloat)progress {
    if (![WRNavigationBar needUpdateNavigationBar:toVC]) {
        return;
    }
    // 源码中非黑名单的正常处理
}

这两处改动解决了我的问题,框架的其它特性没做验证,供大家参考~

@xhjss
Copy link

xhjss commented Aug 6, 2018

needUpdateNavigationBar 没有这个方法哈

@banchichen
Copy link

@xhjss 有的,难道是你的版本比较低?

image

@370966584
Copy link

@ banchichen 设置完还是不行 还有needUpdateNavigationBar为什么跟你看的实现不一样

  • (BOOL)needUpdateNavigationBar:(UIViewController *)vc {
    NSString *vcStr = NSStringFromClass(vc.class);
    if ([self isLocalUsed]) {
    return [[self whitelist] containsObject:vcStr]; // 当白名单里 有 表示需要更新
    } else {
    return ![[self blacklist] containsObject:vcStr];// 当黑名单里 没有 表示需要更新
    }
    }

@banchichen
Copy link

@370966584 注意下方法名字,我指的是updateNavigationBarWithFromVC:toVC:progress:方法。

@370966584
Copy link

370966584 commented Sep 3, 2018

image
@banchichen 是设置了 但是还是不行 我用作者的Demo从首页直接 present TZImagePickerController
我看到 会闪下黑色的背景

@banchichen
Copy link

banchichen commented Sep 3, 2018

@370966584 我这可以的,就是作者最新的Demo代码。只改动我上面说的2处地方,黑名单是生效的。

你是不是漏看了第一条,没把TZImagePickerController放到黑名单里?

@370966584
Copy link

370966584 commented Sep 3, 2018

@banchichen 可以了多谢TZ大神 不过 我就有点纳闷 为什么作者Demo中黑名单没有TZImagePickerController,SpecialController present也没问题,直接在首页present就有问题了 矮

@Liyongcong
Copy link

// WRNavigationBar 不会对 blackList 中的控制器有影响
[WRNavigationBar wr_setBlacklist:@[@"TZImagePickerController"]];
然后按照

  • (void)updateNavigationBarWithFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC progress:(CGFloat)progress {
    if (![WRNavigationBar needUpdateNavigationBar:toVC]) {
    return;
    }
    // 源码中非黑名单的正常处理
    }还是不行呀

@dte2mdj
Copy link

dte2mdj commented Apr 11, 2019

只需要设置这个就可以了,亲测有效
// WRNavigationBar 不会对 blackList 中的控制器有影响
[WRNavigationBar wr_setBlacklist:@[@"SpecialController",
@"TZPhotoPickerController",
@"TZGifPhotoPreviewController",
@"TZAlbumPickerController",
@"TZPhotoPreviewController",
@"TZVideoPlayerController"]];

@Sxiaobai
Copy link

Sxiaobai commented May 6, 2019

只有第一次生效了,点击取消在弹出来之后还是白色

@x-wenote
Copy link

  • (void)viewDidLoad {
    [super viewDidLoad];
    self.needShowStatusBar = ![UIApplication sharedApplication].statusBarHidden;
    self.view.backgroundColor = [UIColor whiteColor];
    // 建议作者把下面两句话去掉
    // self.navigationBar.barStyle = UIBarStyleBlack;
    // self.navigationBar.translucent = YES;
    }

@GymotgM
Copy link

GymotgM commented Nov 3, 2020

[WRNavigationBar wr_setBlacklist:@[@"TZImagePickerController",
@"SpecialController",
@"TZPhotoPickerController",
@"TZGifPhotoPreviewController",
@"TZAlbumPickerController",
@"TZPhotoPreviewController",
@"TZVideoPlayerController"]];

  • (void)updateNavigationBarWithFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC progress:(CGFloat)progress {
    if (![WRNavigationBar needUpdateNavigationBar:toVC]) {
    return;
    }

    // change navBarBarTintColor
    UIColor *fromBarTintColor = [fromVC wr_navBarBarTintColor];
    UIColor *toBarTintColor = [toVC wr_navBarBarTintColor];

    UIColor *newBarTintColor = [WRNavigationBar middleColor:fromBarTintColor toColor:toBarTintColor percent:progress];
    if ([WRNavigationBar needUpdateNavigationBar:fromVC] || [WRNavigationBar needUpdateNavigationBar:toVC]) {
    [self setNeedsNavigationBarUpdateForBarTintColor:newBarTintColor];
    }

    // change navBarTintColor
    UIColor *fromTintColor = [fromVC wr_navBarTintColor];
    UIColor *toTintColor = [toVC wr_navBarTintColor];
    UIColor *newTintColor = [WRNavigationBar middleColor:fromTintColor toColor:toTintColor percent:progress];
    if ([WRNavigationBar needUpdateNavigationBar:fromVC]) {
    [self setNeedsNavigationBarUpdateForTintColor:newTintColor];
    }

    // change navBarTitleColor(在wr_popToViewController:animated:方法中直接改变标题颜色)
    UIColor *fromTitleColor = [fromVC wr_navBarTitleColor];
    UIColor *toTitleColor = [toVC wr_navBarTitleColor];
    UIColor *newTitleColor = [WRNavigationBar middleColor:fromTitleColor toColor:toTitleColor percent:progress];
    [self setNeedsNavigationBarUpdateForTitleColor:newTitleColor];

    // change navBar _UIBarBackground alpha
    CGFloat fromBarBackgroundAlpha = [fromVC wr_navBarBackgroundAlpha];
    CGFloat toBarBackgroundAlpha = [toVC wr_navBarBackgroundAlpha];
    CGFloat newBarBackgroundAlpha = [WRNavigationBar middleAlpha:fromBarBackgroundAlpha toAlpha:toBarBackgroundAlpha percent:progress];
    [self setNeedsNavigationBarUpdateForBarBackgroundAlpha:newBarBackgroundAlpha];

}

突然发现导航栏都白了,全局黑名单后,再加入return,效果明显!!!!

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

10 participants