SmoothNavDemo icon indicating copy to clipboard operation
SmoothNavDemo copied to clipboard

在iOS8和iOS9中会崩溃……

Open xnxy opened this issue 7 years ago • 2 comments

将UINavigationController+Cloudox.m 方法“- (void)setNeedsNavigationBackground:(CGFloat)alpha” 中的barBackgroundView、backgroundImageView、backgroundEffectView修改成下方……

// 导航栏背景透明度设置 UIView *barBackgroundView;// _UIBarBackground UIImageView *backgroundImageView;// UIImageView UIView *backgroundEffectView;// UIVisualEffectView

if (@available(iOS 10.0, *)) {//
    barBackgroundView = [self.navigationBar.subviews objectAtIndex:0];
    backgroundImageView = [barBackgroundView.subviews objectAtIndex:0];
    backgroundEffectView = [barBackgroundView.subviews objectAtIndex:1];
}else{
    for (UIView *view in self.navigationBar.subviews) {
        if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
            barBackgroundView = view;
        }
    }
    for (UIView *otherView in barBackgroundView.subviews) {
        if ([otherView isKindOfClass:NSClassFromString(@"UIImageView")]) {
            backgroundImageView = (UIImageView *)otherView;
        }else if ([otherView isKindOfClass:NSClassFromString(@"_UIBackdropView")]) {
            backgroundEffectView = otherView;
        }
    }
}

xnxy avatar Nov 16 '17 06:11 xnxy

竟然又发现了一个坑……

xnxy avatar Nov 17 '17 01:11 xnxy

iOS 这个导航栏就是个大坑啊。。

zcwlwen avatar Mar 22 '18 07:03 zcwlwen