iOS7 - Change UINavigationBar border color

后端 未结 15 2067
时光取名叫无心
时光取名叫无心 2020-12-07 14:44

Is it possible to change the grey border-bottom color of the UINavigationBar in iOS7?

I already tried to remove to border, but this is not working:

[         


        
15条回答
  •  鱼传尺愫
    2020-12-07 15:17

    Picture 1

    you can use Reveal to see the border color is the UIImageView's backgroundColor. so directly modifying the imageView's backgroundColor or hide it.

    the code: i write in @interface QdtTabBarController : UITabBarController

    Class backGroundClass = NSClassFromString(@"_UIBarBackground");
    for (UIView *view in self.tabBar.subviews) {
        if ([view isKindOfClass:backGroundClass]) {
            for (UIView *view2 in view.subviews) {
                if ([view2 isKindOfClass:[UIImageView class]]) {
                    dispatch_async(dispatch_get_main_queue(), ^{
                        view2.backgroundColor = [UIColor redColor];
                    });
                };
            };
            break;
        }
    }
    

    Picture 2

提交回复
热议问题