定制UITabBar显示样式
定制UITabBar显示样式

思路是这样子的:
1. 初始化UITabBarController,并装载进来几个其他的ViewController

2. 获取每个控制器的UITabBarItem

3. 单独配置每个ViewController对应的UITabBarItem(其中,文字可以设置偏移量)

就这么简单哦!
问:如何设置UITabBarController高亮选中的颜色值呢?

问:[UITabBar appearance]能干什么?
他是进行UITabBarController全局设定的,也就是说不需要你一个一个的单独设定.
To customize the UITabBar you must have an referrer to the UITabBarController.
Open your class wich refers to the UITabBarController. Add the code below in your class. E.g. in the viewDidLoad: method.
Customize the UITabBar by setting the backgroundimage of your UITabBar.
UIImage *tabBackground = [[UIImage imageNamed:@"tabBarBackground.jpg"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// Set background for all UITabBars
[[UITabBar appearance] setBackgroundImage:tabBackground];
// Set background for only this UITabBar
[[tabBarController tabBar] setBackgroundImage:tabBackground];
Customize the UITabBar by setting the tintColor for the images.
// Set tint color for the images only for this tabbar
[[tabBarController tabBar] setSelectedImageTintColor:[UIColor brownColor]];
[[tabBarController tabBar] setTintColor:[UIColor whiteColor]];
// Set tint color for the images for all tabbars
[[UITabBar appearance] setSelectedImageTintColor:[UIColor brownColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
Customize the UITabBar by setting the selectionIndicatorImage.
// Set selectionIndicatorImage for this tabbar
[[tabBarController tabBar] setSelectionIndicatorImage:[UIImage imageNamed:@"selectedtab.png"]];
// Set selectionIndicatorImage for all tabbars
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selectedtab.png"]];
Now you've an full customized UITabBar!
问:UITabBar的图片尺寸是多少呢?
icon为 60x60pix 的png图片,使用时请用如下格式(如图片名字为 newDay@2x, 使用时直接使用名字即可)

问:如何隐藏UITabBar上的那条黑线?

[[UITabBar appearance] setShadowImage:[UIImage imageNamed:@"tm.png"]];
The shadow image to be used for the tab bar.
The default value is nil, which corresponds to the default shadow image. When non-nil, this property represents a custom shadow image to show instead of the default. For a custom shadow image to be shown, a custom background image must also be set using the backgroundImage property. If the default background image is used, then the default shadow image will be used regardless of the value of this property.
根据这个描述信息来看,如果设定了setShadowImage,那也必须设定背景图片哦.
附录:
1. 样式

2. 一些尺寸

定制UITabBar显示样式的更多相关文章
- SharePoint 2013 定制搜索显示模板(二)
前言 之前一篇博客,简单的介绍了如何定制搜索显示模板,这一次,我们介绍一下如何定制搜索显示时,弹出来的那个页面,相信这个大家也都会遇到的. 1.第一部分就是搜索显示模板的部分,第二部分就是搜索项目详情 ...
- 第二篇、Swift_自定义 tabbar 的 badgeValue显示样式
在实际的开发中,我们常常需要根据实际的需求,去改变bageValue的显示样式,默认是红色的背景,白色的字体颜色 使用方式: class BKTabBarController: UITabBarCon ...
- SharePoint 2013 定制搜索显示模板
前言 之前我们已经介绍了一些关于搜索的相关配置,当然,用户关于搜索的要求可能是各种各样.有时候,用户会说,你们的显示结果太Low了,确实是:不过,在SharePoint中,我们可以很容易的定制搜索结果 ...
- Siteserver-stl:searchOutput(搜索结果)自定义显示样式
stl:searchOutput 自定义显示样式 自定义搜索提交表单需要在<stl:searchOutput>中嵌入显示搜索结果的标签,必须包含的标签 有<stl:pageConte ...
- Win32编程:窗口类样式+窗口外观样式+窗口显示样式
1.窗口类样式WNDCLASS.style CS_VREDRAW 提供窗口位置变化事件和高度变化事件的处理程序,功能是重绘窗口 CS_HREDRAW 提供窗口位置变化事件和宽度变化事件的处理程序,功能 ...
- POWERDESIGNER中显示样式设置
1.调整表.视图的显示样式. 右键选中的对象,选择format(或ctrl+t),在弹出窗口中选中content,可以设置只显示表名还是把所有列也显示出来. 2.如何显示表中字段的code. tool ...
- 改变HTML中超链接的显示样式
更详细的内容请参考:http://www.w3school.com.cn/tags/tag_a.asp HTML中的代码如下: <a class="news_title" t ...
- 解决eclipse maven工程中src/main/resources目录下创建的文件夹所显示样式不是文件夹,而是"包"图标样式的问题
参考:http://blog.csdn.net/luwei42768/article/details/72268246 eclipse项目中创建maven项目后,有时在执行命令maven update ...
- Sharepoint 2013内容查询Web部件自定义显示样式(实战)
分享人:广州华软 星尘 一. 前言 在进行Sharepoint开发时,经常会遇到内容展示个性化需求的问题,当然如果通过自定义开发控件对于内容展示的需求基本都可以很好的解决,但自定义开发也有不好的地方, ...
随机推荐
- (转)python time模块和datetime模块详解
python time模块和datetime模块详解 原文:http://www.cnblogs.com/tkqasn/p/6001134.html 一.time模块 time模块中时间表现的格式主要 ...
- (转)CentOS分区操作详解
CentOS分区操作详解 原文:http://blog.csdn.net/yonggeit/article/details/77924393 磁盘分区 分区格式的两种选择:MBR和GPT 分区命令: ...
- Linux上用户之间对话
Linux上用户之间对话 昨天想在CentOS7上与另外一个用户对话,但把命令忘记了,特此记录下来. Write命令 write命令是单向发送一条消息给同机器的Linux用户.首先通过who命令查看谁 ...
- ElasticSearch 6.2.3 Windows10 安装
一.安装Es 1.安装java,最新版本的ElasticSearch 需要java8 版本,因此需要先去Oracle官网下载jdk,下载之后就直接安装: 2.安装过程中将其安装目录copy下来:C:\ ...
- bzoj 3874: [Ahoi2014&Jsoi2014]宅男计划
Description 外卖店一共有N种食物,分别有1到N编号.第i种食物有固定的价钱Pi和保质期Si.第i种食物会在Si天后过期.JYY是不会吃过期食物的. 比如JYY如果今天点了一份保质期为1天的 ...
- bat执行java程序 good
start.bat set MY_HOME=%~dp0 set JMS_BINDING_PATH=%MY_HOME%..\binds set JAVA_HOME=C:\Program Files\J ...
- sql 列名无效
版权声明:本文为博主原创文章,未经博主允许不得转载. 在SQLServer2008中,当设计(修改)表结构之后,再用SQL语句时,列名会显示无效,但执行可以通过 如下图: 原因是SQL Server的 ...
- PHP学习3——数组
主要内容: 简介 常用的方法 循环遍历数组 PHP预定义数组 数组的处理函数 数组 PHP由于是弱类型的语言,他的变量类型是可以自由变换的,他的数组很自由,长度是可以动态增加的. 他的索引默认为数字0 ...
- JMS - ActiveMQ的简单使用
首先需要下载ActiveMQ,下面的链接给我们列出了所有版本:http://activemq.apache.org/download-archives.html每个版本为不同的OS提供了链接: 公司电 ...
- 定时器setTimeout()和setInterval()使用心得整理
JavaScript提供定时执行代码的功能,叫做定时器(timer),主要由setTimeout()和setInterval()这两个函数来完成. 一.setTimeout() setTimeout函 ...