设置tabbar标签栏的背景图片 insertSubview: atIndex:
2012-07-01 16:34
239 查看
//设置tabbarcontroller的tabbaritem图片的大小
UIImage *tabbarimage=[UIImage
imageNamed:@"first.png"];
UIImageView *tabBarBackgroundImageView = [[UIImageView
alloc] initWithFrame:CGRectMake(0, 0,
self.tabBar.frame.size.width,
self.tabBar.frame.size.height)];
//tabBarBackgroundImageView.contentMode = UIViewContentModeScaleAspectFit;//效果将按原图原来的比例缩放
tabBarBackgroundImageView.image =tabbarimage;
[self.tabBar
insertSubview:tabBarBackgroundImageView
atIndex:1]; //atIndex决定你的图片显示在标签栏的哪一层
UIImage *tabbarimage=[UIImage
imageNamed:@"first.png"];
UIImageView *tabBarBackgroundImageView = [[UIImageView
alloc] initWithFrame:CGRectMake(0, 0,
self.tabBar.frame.size.width,
self.tabBar.frame.size.height)];
//tabBarBackgroundImageView.contentMode = UIViewContentModeScaleAspectFit;//效果将按原图原来的比例缩放
tabBarBackgroundImageView.image =tabbarimage;
[self.tabBar
insertSubview:tabBarBackgroundImageView
atIndex:1]; //atIndex决定你的图片显示在标签栏的哪一层
相关文章推荐
- 设置背景图,并在上面添加可随意拖动的图片标签
- tabbar 设置背景图片
- iOS开发-设置tabBar的背景图片
- img 标签导入png图片背景设置透明
- 设置tabBar的背景图片,选中文字颜色
- 【微信小程序常见问题】view标签设置背景图片手机无法预览解决方案一
- 从设置a标签背景图片无法显示探究background-image:url()
- 【微信小程序常见问题】view标签设置背景图片手机无法预览解决方案二
- Java中JLabel设置背景颜色,设置图片标签,重叠显示
- 关于js设置标签样式来显示图片背景无效的解决方案
- iOS - 如何去除tabbar顶部线条及设置背景图片
- 09、canvas标签之绘制图片与设置背景
- iOS - 如何去除tabbar顶部线条及设置背景图片
- IOS开发教程--如何去除tabbar顶部线条及设置背景图片
- Qt: windows下设置指定图片填充形成桌面背景.(实测)
- 怎样将图片设置为PPT背景
- 关于背景图片上打标签定位的问题
- GEF常见问题1:为图形编辑器设置背景图片
- img 标签 / div 背景图片 默认图片 裂图替代
- 设置TabBar分栏控制器上图片的大小问题