iOS tabbar 背景,右上角数字,tabbar获取方法 总结

//tabbar选中时的颜色

    tabBarController.tabBar.tintColor=[UIColor whiteColor] ;

   

//右上角数字

    //可以添加个lable来改变原点的大小,

    //使用通知/kvo来改变上面的数字

     item1.badgeValue=@" “;

    

//tabBarItem获取方法:

    [[[tabBarController tabBar] items] objectAtIndex:i];

 

//设置标签栏的背景图片 2中方式

 

1. [tab setBackgroundImage:[UIImage imageNamed:@"导航栏@2x.png"]];//设置背景

 

2. UIImage *image=[UIImage imageNamed:@"导航栏@2x.png"];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:

                            CGRectMake(0, -15,tab.frame.size.width, tab.frame.size.height+15)];//相对位置的修改

    imageView.image =image;

    [tab  insertSubview:imageView  atIndex:0];//插入的位置

 

文章来自:http://www.cnblogs.com/cfl911014/p/4840404.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3