tabbar 去除黑线

作者: Ivan_Brown | 来源:发表于2016-11-04 15:31 被阅读31次

    CGRect rect = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);

    CGContextFillRect(context, rect);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    [tabbar.tabBar setBackgroundImage:img];

    [tabbar.tabBar setShadowImage:img];

    [tabbar.tabBar setBackgroundColor:[UIColor whiteColor]];(如果不加上这行代码,你的tabbar的颜色是透明的.如果你是自定义的背景视图,可以在上方的setBackgroundImage添加你自定义的图片

    tabbar 设置背景色

    self.tabBarController.tabBar.translucent = false;

    self.tabBarController.tabBar.tintColor = [UIColor whiteColor];

    相关文章

      网友评论

        本文标题:tabbar 去除黑线

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