纯代码编写UITabBarController, 不多说,直接见代码

RViewController1 *vc1 = [[RViewController1 alloc]init];

    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:vc1];
//只赋值 tabBarItem.title, 通过.title属性取值是取不到值
//navController.tabBarItem.title = @"Page 1"; //相当于对tabBarItem.title 和 navigationItem.title同时赋值
navController.title = @"Page 1";
navController.tabBarItem.image = [UIImage imageNamed:@"1.jpg"]; RViewController2 *vc2 = [[RViewController2 alloc]init];
vc2.title =@"Page 2";
// UITabBarItem *item2 = [[UITabBarItem alloc]initWithTitle:@"Page 2" image:[UIImage imageNamed:@"2.png" ] selectedImage:[UIImage imageNamed:@"2_pressed.png"]];
vc2.tabBarItem.image = [UIImage imageNamed:@"2.png"]; RViewController3 *vc3 = [[RViewController3 alloc]init];
vc3.title =@"Page 3";
vc3.tabBarItem.image = [UIImage imageNamed:@"3.png"]; RViewController4 *vc4 = [[RViewController4 alloc]init];
vc4.title =@"Page 4";
vc4.tabBarItem.image = [UIImage imageNamed:@"4.png"];
vc4.tabBarItem.badgeValue = @""; RViewController5 *vc5 = [[RViewController5 alloc]init]; //创建 UITabItem的实例
UITabBarItem *item1 = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemHistory tag:];
vc5.tabBarItem = item1; NSArray *controllers = [NSArray arrayWithObjects:navController,vc2,vc3,vc4, nil]; UITabBarController *tabController = [[UITabBarController alloc]init];
tabController.viewControllers = controllers; self.window.rootViewController = tabController;

UITabBarController 初学的更多相关文章

  1. 移动开发:初学 iOS-UIViewController 心得

    初学 iOS,本文翻译了一些 iOS 官网上的 UIViewController 的知识点,如有不到位或不正确的地方,还请指正: 本文所介绍的内容的目标: 理解content view control ...

  2. DDD初学指南

    去年就打算总结一下,结果新换的工作特别忙,就迟迟没有认真动手.主要内容是很多初学DDD甚至于学习很长时间的同学没有弄明白DDD是什么,适合什么情况.这世界上没有银弹,抛开了适合的场景孤立的去研究DDD ...

  3. gulp初学

    原文地址:gulp初学 至于gulp与grunt的区别,用过的人都略知一二,总的来说就是2点: 1.gulp的gulpfile.js  配置简单而且更容易阅读和维护.之所以如此,是因为它们的工作方式不 ...

  4. 初学seaJs模块化开发,利用grunt打包,减少http请求

    原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...

  5. UITabBarController 升级定制

    UITabBarController 定制 特点 用法 1.准备工作: 加入你的相关图片,放入了Assets.xcassets; 导入Categroy文件夹(这个里面的文件,在这里不详细说明了,有疑问 ...

  6. UITabBarController 基本定制

    UITabBarController 定制 特点 用法 1.准备好你的tabBar图片及其他图片(哈哈哈!!!!),我的图片都放在了Assets.xcassets中. 2.导入本工程中的Categro ...

  7. 自定义UITabBarController标签视图控制器

    首先创建一个类,继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写 ...

  8. 混合使用UITabBarController和UINavigationController

    混合使用这两个控件的好处是我们可以在NavigationBar添加更多的东西,如标题,按钮等.让用户能够获得更多的信息. UITabBarController的属性ViewControllers接受以 ...

  9. 基本组件的使用——UITabBarController

    和UINavigationController的作用差不多,UITabBarController也可以在多个UIViewController中切换 这个控件的使用相对简单,只需要为该控件的viewCo ...

随机推荐

  1. 【转】NI语法 JNI参考 JNI函数大全

    原文网址:http://blog.sina.com.cn/s/blog_5de73d0b0101chk1.html 一.对照表 Java类型    本地类型         描述boolean     ...

  2. geoserver 安装 sql server 插件

    Did you download and install the sql server plugin as well?   http://downloads.sourceforge.net/proje ...

  3. MongoDB之二(增删查改)

    一: Insert操作 上一篇也说过,文档是采用“K-V”格式存储的,如果大家对JSON比较熟悉的话,我相信学mongodb是手到擒来,我们知道JSON里面Value 可能是“字符串”,可能是“数组” ...

  4. 使用Spring MVC 的表单控制器SimpleFormController

    以注册过程为例,我们可能会选择继承AbstractController来实现表单的显示,继承AbstractCommandController来实现表单的处理 ,这样是可行的,但必须要维护两个控制器 ...

  5. x&-x

    x&-x的值是啥米呢?列入10 二进制位 1010为2  1011则为 1,1000为8,就是一个整数对应的二进制数中1所在最低位的权值. 在树状数组中很有用

  6. 2013华为校园招聘java实现(大家水个回复啊)

    package 乒乒乓乓; import java.util.Scanner; /* * * author:hansongjiang 分别求整数数组里面的奇数与偶数之和 问题描述:从标准输入里面接收一 ...

  7. (转)如何在Excel2013中制作条形码

    文章来源:http://www.officezhushou.com/excel2013/3905.html 注意:如果发现条形码不能移动的情况,请点击开发工具-设计模式,那么你就可以移动你的条形码了 ...

  8. poj1087 A Plug for UNIX & poj1459 Power Network (最大流)

    读题比做题难系列…… poj1087 输入n,代表插座个数,接下来分别输入n个插座,字母表示.把插座看做最大流源点,连接到一个点做最大源点,流量为1. 输入m,代表电器个数,接下来分别输入m个电器,字 ...

  9. Linux下OpenSSL 安装

    安装环境:  操作系统:CentOs6.3 OpenSSL Version:openssl-1.0.0e.tar.gz 目前版本最新的SSL地址为http://www.openssl.org/sour ...

  10. firefox和chrome对于favicon.ico关于content-security-policy的不同处理

    1.favicon.ico是网站的title图标 2.在设置CSP时,举例如下,表示只允许来源为https://my.alipay.com的图片,如果不是,则向指定的url(report.php)发出 ...