如何制作透明的自定义标签栏?

时间:2012-10-04 14:30:37

标签: iphone objective-c xcode uitabbar

如何制作透明的自定义标签栏?我设置背景图像是透明图像,但标签栏有黑色图像?如何删除黑色图像?请帮我。查看图片。enter image description here

2 个答案:

答案 0 :(得分:1)

将TabBar的色调颜色设置为clearColor

[[self tabBar] setTintColor:[UIColor clearColor]];

答案 1 :(得分:1)

尝试,创建图像并设置为背景ios5 =>只有:

CGRect rect = CGRectMake(0, 0, 1, 1);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [[UIColor clearColor] colorWithAlphaComponent:0.8].CGColor);
    CGContextFillRect(context, rect);
    UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    [self.tabBarController.tabBar setBackgroundImage:transparentImage];