给tabbar添加背景

来源:互联网 发布:淘宝买家好评率查询 编辑:程序博客网 时间:2024/06/06 13:56


 
群里见你发的帖子
在加载tabbar的时候,做一个如图的图片
然后添加一下下边的代码试试:
    CGRect frame = CGRectMake(0.0, 0.0, 320.0, 49.0);
    UIView *v = [[UIView alloc] initWithFrame:frame];
    UIImage *img = [UIImage imageNamed:@"tabbar.png"];
    UIColor *c  = [[UIColor alloc] initWithPatternImage:img];
    v.backgroundColor = c;
    [m_TabBar.tabBar insertSubview:v atIndex:0];
    m_TabBar.tabBar.opaque  =YES;
    [c release];
    [v release];

图片颜色过浅的话可以自己 加个半透的选中效果。


http://gaohaijun.blog.163.com/blog/static/1766982712010112292032629/


原创粉丝点击