UITabBarController 初学
纯代码编写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 初学的更多相关文章
- 移动开发:初学 iOS-UIViewController 心得
初学 iOS,本文翻译了一些 iOS 官网上的 UIViewController 的知识点,如有不到位或不正确的地方,还请指正: 本文所介绍的内容的目标: 理解content view control ...
- DDD初学指南
去年就打算总结一下,结果新换的工作特别忙,就迟迟没有认真动手.主要内容是很多初学DDD甚至于学习很长时间的同学没有弄明白DDD是什么,适合什么情况.这世界上没有银弹,抛开了适合的场景孤立的去研究DDD ...
- gulp初学
原文地址:gulp初学 至于gulp与grunt的区别,用过的人都略知一二,总的来说就是2点: 1.gulp的gulpfile.js 配置简单而且更容易阅读和维护.之所以如此,是因为它们的工作方式不 ...
- 初学seaJs模块化开发,利用grunt打包,减少http请求
原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...
- 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 ...
随机推荐
- Google Chrome中的高性能网络 (三)
使用预连接优化了TCP连接管理 已经预解析到了主机名,也有了由OmniBox和Chrome Predictor提供信号,预示着用户未来的操作.为什么再进一步连接到目标主机,在用户真正发起请求前完成TC ...
- Android批量插入数据到SQLite数据库
Android中在sqlite插入数据的时候默认一条语句就是一个事务,因此如果存在上万条数据插入的话,那就需要执行上万次插入操作,操作速度可想而知.因此在Android中插入数据时,使用批量插入的方式 ...
- Using the Task Parallel Library (TPL) for Events
Using the Task Parallel Library (TPL) for Events The parallel tasks library was introduced with the ...
- unix时间戳和localtime
今天看代码的时候看到这么一段 void user::setHelpday() { int time = ::getTickCount(); m_helpday = (time +( * ))/( * ...
- HW3.13
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- Spout数据源
Spout 数据源 消息源 Spout 是 Storm 的 Topology 中的消息生产者(即 Tuple 的创造者). Spout 介绍 1. Spout 的结构 Spout 是 Storm 的核 ...
- Redis学习资料汇总(荐)
Redis学习手册系列: http://www.cnblogs.com/stephen-liu74/category/354125.html Redis详解:sorted sets数据类型及操作-IT ...
- A Tour of Go For
Go has only one looping construct, the for loop. The basic for loop looks as it does in C or Java, e ...
- Android ArrayAdpater 填充集合
在这里我们新创建一个任务来演示 然后再布局文件中定义一个ListView 来当作显示数据的容器,布局文件代码如下: <LinearLayout xmlns:android="http: ...
- MFC TreeCtrl 控件(一):简单使用
本文描写叙述了 MFC 中的树形控件 TreeCtrl 的简单使用,内容包含数据项的加入.图标设置.提示信息设置等. 新建基于对话框的应用程序,加入一个 TreeCtrl ,为其定义一个控件变量 m_ ...