美文网首页
ios 改变系统UITabbar 和UINavigaitonba

ios 改变系统UITabbar 和UINavigaitonba

作者: 高先生Devin | 来源:发表于2017-03-07 23:00 被阅读0次

    1. //改变标签栏横线颜色

    NSArray  *tabArray=self.tabBarController.tabBar.subviews;

    for ( id obj  in tabArray) {

    if ([obj isKindOfClass:[UIImageView class]]) {

    UIImageView *imageView=(UIImageView *) obj;

    imageView.backgroundColor=View_ToolBar;

    }

    }

    2.//改变导航条横线颜色

    //给imgaeview 添加一个类别

    + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size

    {

    CGRect rect = CGRectMake(0, 0, size.width, size.height);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context,

    color.CGColor);

    CGContextFillRect(context, rect);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;

    }

    //调用

    [[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:tabBar_line size:CGSizeMake(kDeviceWidth, 1)]];

    相关文章

      网友评论

          本文标题:ios 改变系统UITabbar 和UINavigaitonba

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