tabbar navigation黑线的处理(隐藏及颜色修改)

//   去除tabbar顶部的线

      [self.tabBarsetBackgroundImage:[[UIImagealloc]init]];

//      去除navigationbar底部的黑线

        [self.navigationBarsetShadowImage:[UIImagenew]];



//    修改tabbar的颜色

    UIView *backView = [[UIViewalloc] initWithFrame:CGRectMake(0,0, [UIScreenmainScreen].bounds.size.width,49)];

    backView.backgroundColor =TabColor;

//    修改tabbar黑线的颜色

    UIView *line = [[UIViewalloc]initWithFrame:CGRectMake(0,0,ScreenWidth,LineHeight)];

    line.backgroundColor =LineColor;

    [self.tabBarinsertSubview:line atIndex:0];

    [self.tabBarinsertSubview:backView atIndex:0];

    self.tabBar.opaque =YES;


//    设置navbar的颜色

    [self.navigationBarsetBackgroundImage:[Helper imageWithTheColor:NavColor]forBarPosition:UIBarPositionTopbarMetrics:UIBarMetricsDefault];

//    设置navbar下面线条颜色

    [self.navigationBarsetShadowImage:[Helper imageWithTheColor:[UIColor colorFromHexRGB:@"e7e7e7"]]];




#import "Helper.h"


@implementation Helper


//生成全色的图片

+ (UIImage *)imageWithTheColor:(UIColor *)color {

    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);

    //打开图片上下文

    UIGraphicsBeginImageContext(rect.size);

    //获取当前图片上下文

    CGContextRef context = UIGraphicsGetCurrentContext();

    //设置颜色

    CGContextSetFillColorWithColor(context, [color CGColor]);

    //填充颜色

    CGContextFillRect(context, rect);

    //生成图片

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    //结束绘画

    UIGraphicsEndImageContext();

    

    return image;

}


@end




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值