UITabbar item 设置笔记
很长一段时间都是用代码来写UITabbarController,试着用xib来写一次,但是遇到tabbar item的图标自定义的时候不知道从何入手,比如定义选定前和选定后的icon图片,这地方还是不太明显。现在用代码记录一下
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabBar.png"]];
或
[[self.RootTabbarController tabBar] setBackgroundImage:[UIImageimageNamed:@"tabbar.png"]]; ITabBarController *tabController = (UITabBarController *)self.window.rootViewController; selectedImage = [UIImage imageNamed:@"contact"];
unselectedImage = [UIImage imageNamed:@"contact"];
UITabBarItem *item3 = [tabBar.items objectAtIndex:2];
[item3 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
COLOR_APP,UITextAttributeTextColor, nil]
forState:UIControlStateNormal]; // [item3 setFinishedSelectedImage:selectedImage
// withFinishedUnselectedImage:unselectedImage];
[item3 setImage:selectedImage];
[item3 setSelectedImage:selectedImage];
这个图片上标记了tabbar item的各种属性
UIimageWithRenderingMode:UIImageRenderingModeAlwaysTemplate这个作为ios7里面的新属性,应该注意
很多时候在ios7上使用自定义的tabbar,tabbar顶部会出现一个线,此时解决方案
[[UITabBarappearance] setShadowImage:[[UIImagealloc] init]];
原理是用一个一像素的线图覆盖。
UITabbar item 设置笔记的更多相关文章
- Android为ListView的Item设置不同的布局
MainActivity如下: package cc.testlistview; import java.util.ArrayList; import java.util.HashMap; impor ...
- ## GridView 布局:item设置的高度和宽度不起作用、自动适配列数、添加Header和Footer ##
一.item设置的高度和宽度不起作用 转自:http://www.cnblogs.com/0616--ataozhijia/p/6031875.html [Android Pro] listView和 ...
- Sublime Text 3设置笔记
Sublime Text 3设置笔记 Sublime Text 3设置指南 1. 安装package control 下载package control源码安装包,并解压: http://yun.ba ...
- GridView item设置点击背景
GridView item设置点击背景 android:listSelector="@android:color/transparent"
- uitabbar 标题设置 button text attributes only respected for UIControlStateNormal
uitabbar 标题设置 button text attributes only respected for UIControlStateNormal [[UITabBarItem appearan ...
- Typora + picgo + sm.ms 图床设置笔记
Typora + picgo + sm.ms 图床设置笔记 编辑于2020-03-26 本文部分内容在作者教程的基础上进行了二次编辑,如有重复,纯属必然 在此感谢大佬们的无私付出与分享 之前 用了 g ...
- [Android Pro] listView和GridView的item设置的高度和宽度不起作用
referece to : http://blog.csdn.net/beibeixiao/article/details/9032569 1. 在Android开发中会发现,有时listVi ...
- windows设置笔记
1. 使用Sudo提升权限 http://www.alexblair.org/user-alexblair-post-1046.html 新建 sudo.js 放到 C:\windows\下面,内容如 ...
- 系统UITabBar属性设置
设置背景: [_tabBar setBackgroundImage:[UIImage imageNamed:@"bg_tabbar"]]; 设置某个Item选中的效果: _tabB ...
随机推荐
- Shell script for logging cpu and memory usage of a Linux process
Shell script for logging cpu and memory usage of a Linux process http://www.unix.com/shell-programmi ...
- **apache环境下 禁止显示 index of/ 目录下(如何禁止访问网站根目录)
比如: http://123.57.49.XX6// 当这样访问的时候,可能会列出网站的根目录 如何禁止列出网站目录,方法如下: 让别人知道你的网站目录结构直接查看你目录下的所有文件是很危险的一个事情 ...
- ExtJs之VTYPE验证
<!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...
- hdu2023 求平均成绩 ~~很闲~~~
#include<iostream> #include<stdio.h> #include<math.h> #include<string.h> #in ...
- 五分钟轻松搞定产品需求文档!这可能史上最全PRD文档模板
本文由 @JustWu 原创发布于社区 为什么写这篇文章? 第一:写PMCAFF的PRD文档,大家都是用户,比较好参考与理解,方便大家来找我写的不好的地方. 第二:我在自学PRD文档的编写过程中,总 ...
- React-非dom属性-dangerouslySetInnerHTML标签
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8& ...
- JavaScript ECAMScript5 新特性——get/set访问器
之前对get/set的理解一直有误,觉得get set 是对象属性方法.看了别人的博客也有很多疑问,今天系统的做了很多测试终于弄明白了.(自己通过看书和写demo测试的,如有不对欢迎大家批评指正) g ...
- 开启MySQL慢查询日志
1.修改my.cnf或my.ini 1).linux----------------------------------- /etc/my.cnf 文件 [mysqld] long_query_ti ...
- Spring AOP 创建增强类
AOP联盟为增强定义了org.aopalliance.aop.Advice接口,Spring支持5种类型的增强: 1)前置增强:org.springframework.aop.BeforeAd ...
- poj2265
斜坐标系,注意找规律.说明在代码里. e- ?(x):-(x))<eps) ][] = { { , }, { -, }, { -, }, { , - }, { , - }, { , } ...