定制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开发时,经常会遇到内容展示个性化需求的问题,当然如果通过自定义开发控件对于内容展示的需求基本都可以很好的解决,但自定义开发也有不好的地方, ...
随机推荐
- Jmeter断言实例—响应断言
断言有很多种,最最最常用的一种就是响应断言,目前我用的最多是这一种,下面列举一个运用响应断言的实例 对相应的请求添加断言 **Main sample and sub-samples:断言应用于主采样器 ...
- POI基本操作
1.读取excel文件 InputStream is = new FileInputStream(filesrc); POIFSFileSystem fs = new POIFSFileSystem( ...
- orcale 之 pl/sql
基本结构 不多说直接来看下它的结构: DECLARE -- 此处声明一些变量.常量.或者用户自定的数据类型 -- 这一部分是可选的,如果不需要可以不写 BEGIN -- 程序的主体,这里可以写一些合法 ...
- 【STL】count_if
功能 返回满足条件的元素个数 模版 template <class InputIterator, class Predicate> typename iterator_traits< ...
- Windows Server 2008系统中IE8启用和禁用JS
Windows Server 2008系统中IE8默认是启用IE ESC(ie 增强)的,这样会导致该IE不支持JS,开启方法: 1.开始->管理工具->服务器管理器 2.点击服务器管理- ...
- 另一个C#模拟post请求的例子
private string returninstallTmnl(AddTmnlInstallParameter model) { string url = ConfigurationSettings ...
- Spring - 几种RPC模型的使用与比较
Spring中,用JMS搞RPC时会用到: org.springframework.jms.remoting.JmsInvokerServiceExporter org.springframework ...
- VS编译完成后自动复制到远程机器
缘起 最近在调试网络通信,每次一有点小修改,都要将程序从开发机复制到测试机,不胜烦扰.既然我们程序猿,为什么要那么死板呢,能够用代码解决的问题,就不要用手去解决. 解决过程 复制 手工复制外有没有其他 ...
- golang 使用rrd的相关资料
一.简介 RRDtool是指Round Robin Database工具,即环状数据库.从功能上说,RRDtool可用于数据存储+数据展示.著名的网络流量绘图软件MRTG和集群监控系统Gan ...
- 反汇编调试Android
https://code.google.com/p/android/issues/detail?id=73076 http://my.unix-center.net/~Simon_fu/?p=527 ...