iOS

来源:互联网 发布:容祖儿 借过知乎 编辑:程序博客网 时间:2024/05/29 17:59

原文链接:http://blog.csdn.NET/wanglixin1999/article/details/46947655


这个问题一直比较苦恼,网上很多方法实验下来都不是很好,今天终于解决了。

直接上代码:

在tabbarController 中 直接填入下边代码


CGRect rect = CGRectMake(00self.view.frame.size.widthself.view.frame.size.height);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [[UIColor clearColorCGColor]);

    CGContextFillRect(context, rect);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    [self.tabBar setBackgroundImage:img];

    [self.tabBar setShadowImage:img];


[self.tabBar setBackgroundImage:[UIImage imageNamed:@"tabbarbg3.jpg"]];


//如果需要不显示分割线,只需要将下面一句话

[self.tabBar setClipsToBounds:YES];

0 0
原创粉丝点击