UITabBarController
Normal
0
10 pt
0
2
false
false
false
EN-US
ZH-CN
X-NONE
$([{£¥·‘“〈《「『【〔〖〝﹙﹛﹝$(.[{£¥
!%),.:;>?]}¢¨°·ˇˉ―‖’”…‰′″›℃∶、。〃〉》」』】〕〗〞︶︺︾﹀﹄﹚﹜﹞!"%'),.:;?]`|}~¢
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Cambria;
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}
UITabBarController
UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换
1、
创建UITabBarController对象
UITabBarController *tabbar = [[UITabBarController alloc]init];
2、
创建相应的子控制器
ViewController *vc = [[ViewController alloc] init];
vc.tabBarItem.title = @"主页";//设置标题
vc.tabBarItem.image = [UIImage imageNamed:@"1"];//设置图片
FirstViewController *first = [[FirstViewController alloc] init];
first.tabBarItem.title = @"消息";
first.tabBarItem.image = [UIImage imageNamed:@"2"];
3、
把子视图控制器加入UITabbarController
tabbar.viewControllers = @[vc,first];
4、
设置window的rootViewController为UITabbarController
self.window.rootViewController = tabbar
5、
设置tabbarVC选中第几个子视图:
[self.tabBarController setSelectedIndex:2];
6、
跳到某个指定的VC
UIViewController *vc = [self.tabBarController.viewControllers objectAtIndex:1];
[self.tabBarController setSelectedViewController:vc];
7、
获取当前选中的下标:
NSInteger index= self.tabBarController.selectedIndex;
8、
标签栏信息提示:
first.tabBarItem.badgeValue = @"3";
9、
设置选中的颜色(图片、文字)
tabbar.tabBar.tintColor = [UIColor greenColor];
10、
设置背景图:
tabbar.tabBar.backgroundImage = [UIImage imageNamed:@"buy_ex"];
11、
设置背景色
tabbar.tabBar.barTintColor = [UIColor brownColor];
12、
置选中、未选中的图片
UIIm设age *image=[[UIImage imageNamed:@"3"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *image2 =[[UIImage imageNamed:@"tabbar_profile_selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
second.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"个人" image:image selectedImage:image2];
UITabBarController的更多相关文章
- UITabBarController 升级定制
UITabBarController 定制 特点 用法 1.准备工作: 加入你的相关图片,放入了Assets.xcassets; 导入Categroy文件夹(这个里面的文件,在这里不详细说明了,有疑问 ...
- UITabBarController 基本定制
UITabBarController 定制 特点 用法 1.准备好你的tabBar图片及其他图片(哈哈哈!!!!),我的图片都放在了Assets.xcassets中. 2.导入本工程中的Categro ...
- 自定义UITabBarController标签视图控制器
首先创建一个类,继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写 ...
- 混合使用UITabBarController和UINavigationController
混合使用这两个控件的好处是我们可以在NavigationBar添加更多的东西,如标题,按钮等.让用户能够获得更多的信息. UITabBarController的属性ViewControllers接受以 ...
- 基本组件的使用——UITabBarController
和UINavigationController的作用差不多,UITabBarController也可以在多个UIViewController中切换 这个控件的使用相对简单,只需要为该控件的viewCo ...
- Swift - 重写UIKit框架类的init初始化方法(以UITabBarController为例)
原来写了篇文章讲UITabBarController的用法,当时是从UIViewController跳转到UITabBarController页面,代码如下: 1 self.presentViewCo ...
- iOS 怎么设置 UITabBarController 的第n个item为第一响应者?
iOS 怎么设置 UITabBarController 的第n个item为第一响应者? UITabBarController 里面有个属性:selectedIndex @property(nonato ...
- iOS UITabBarController的使用
UITabBarController 和 UINavigationController 几乎是iOS APP的标配. UITabBarController分栏(标签栏)控制器, 和UINavigati ...
- iOS开发UI篇—UITabBarController简单介绍
iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...
- 你真的了解UITabBarController吗?
一:首先查看一下关于UITabBarController的定义 NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarController : UIViewCo ...
随机推荐
- HTML 链接 - href
链接 在HTML的学习中,链接的标签发挥着很大的作用,HTML 使用超级链接与网络上的另一个文档相连.几乎可以在所有的网页中找到链接.点击链接可以从一张页面跳转到另一张页面. 比如说:实例 创建超级链 ...
- 在iOS中使用OpenSSL的Public Key 进行加密
这几天一直潜心于iOS开发,刚好把遇到的问题都记录一下.这次遇到的问题就是如果根据得到的Public Key在iOS 客户端对用户名和密码进行加密. Public Key如下: -----BEGIN ...
- javascript基础知识show
1.javascript的数据类型是什么 基本数据类型:String,boolean,Number,Undefined,Null 引用数据类型:Object(Array,Date,RegExp,Fun ...
- ImageList图标左边有黑色竖线
ImageList图标左边有黑色竖线, 原因 ImageList颜色深度太小引起的,解决方案,把颜色深度调成Depth32Bit 默认: 修改为: 结果: 备注:根据文件获得文件的系统图标: Icon ...
- Kerberos是怎么工作的?
Kerberos是一种计算机网络授权协议,用来在非安全网络中,对个人通信以安全的手段进行身份认证. 采用客户端/服务器结构,并且能够进行相互认证,即客户端和服务器端均可对对方进行身份认证. 关键要素 ...
- a 锚点跳转滑动效果
点击a链接时,跳转到相应id的位置处,有一个滑动效果. <a href="#my">我是跳转到div</a><div id="my" ...
- 转!!MySQL中的存储引擎讲解(InnoDB,MyISAM,Memory等各存储引擎对比)
MySQL中的存储引擎: 1.存储引擎的概念 2.查看MySQL所支持的存储引擎 3.MySQL中几种常用存储引擎的特点 4.存储引擎之间的相互转化 一.存储引擎: 1.存储引擎其实就是如何实现存储数 ...
- python操作csv和excel文件
1.操作csv文件 1).读取文件 import csv f=open("test.csv",'r') t_text=csv.reader(f) for t,i in t_text ...
- nginx配合zabbix编译安装时web下一步跳转问题
很多时候编译安装的时候把zabbix的php包拷贝到web所在目录之后(本文为nginx所在html目录),网页打开http:/localhost/zabbix却进不去下图: 或者是点了下一步没反应, ...
- mac系统使用帮助
在linux下习惯使用ll.la.l等ls别名的童鞋到mac os可就郁闷了-- 其实只要在用户目录下建立一个脚本“.bash_profile”,并输入以下内容即可: alias ll='ls -al ...