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 ...
随机推荐
- DP专题训练之HDU 1506 Largest Rectangle in a Histogram
Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base l ...
- angularjs checkbox 框的操作
前言:今天遇到一个问题,需要对多选按钮进行操作,作为js菜鸟,只能做自己慢慢琢磨了-- <label class="checkbox-inline custom-checkbox no ...
- poj 1626
传送门:http://poj.org/problem?id=1636 题意:有两个监狱,每个监狱有n个人,有m种关系,表示A监狱第i个人不能跟B监狱第j个人在一个监狱,问你最多能换几组人(从A,B监狱 ...
- windows重建图标缓存(解决快捷方式图标丢失,图标加载时间长问题)
新建一个文本文档,把下边的代码输入进去,保存为.bat格式,运行即可 有快捷方式图标丢失或者觉得图标加载速度慢了,就run一下这个,很实用的小工具 rem 关闭Windows外壳程序explorer ...
- 修正iOS从照相机和相册中获取的图片方向(转)
- (UIImage *)fixOrientation { // No-op if the orientation is already correct if (self.imageOrientati ...
- linux开发缩写
1.CONFIG_OF 在一些驱动中经常看到#ifdef CONFIG_OF,这里的OF是Open Firmware. Open Firmware. This was invented long ti ...
- 解决Spark读取Hive分区表出现Input path does not exist的问题
假设这里出错的表为test表. 现象 Hive读取正常,不会报错,Spark读取就会出现: org.apache.hadoop.mapred.InvalidInputException: Input ...
- 通过js给android控件WebView设padding
项目中有个界面是用来显示一个网页的,很简单,放个WebView就ok了,可是返回按钮放在哪 ,ui的设计是在底部显示一个半透明的条,左边有一个返回按钮.这个条显示在内容上面.我有一个担心,就是要是最下 ...
- php-sql-parser sql防注入脚本
<?php /** * SQL Parser from: http://code.google.com/p/php-sql-parser/ * License: New BSD */ class ...
- Java - 安全的退出线程
stop() 存在的问题 使用 stop() 来退出线程是不安全的.它会解除由线程获取的所有锁,可能导致数据不一致. 举个例子: public class StopTest { public stat ...