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];//插入的位置

 

posted on 2015-09-26 10:45  崔付亮  阅读(856)  评论(0编辑  收藏  举报