iOS 多个 tab 页 demo
来源:互联网 发布:二十四节气壁纸软件 编辑:程序博客网 时间:2024/06/06 00:15
简介
在日常的开发中,App 中多个功能模块常常表现为多个 tab 页的形式,利用 tab 页,可以使得 App 的功能模块非常清晰,同时又非常有利于团队的协作开发。本文记录了这样一个 demo 的示例代码。
代码
/** * the codes support iOS 7.0 and later iOS version. * */ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UITabBarController *tabBarController = [[UITabBarController alloc] init]; UIImage *unselecteImage = [[UIImage imageNamed:@"01"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//采用图片的原始格式,系统不对图片进行处理 UIImage *selectedImage = [[UIImage imageNamed:@"02"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; ViewController *vc1 = [[ViewController alloc] init]; vc1.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"微信" image:unselecteImage selectedImage:selectedImage]; //... ViewControllerTwo *vc2 = [[ViewControllerTwo alloc] init]; vc2.title = @"通讯录"; //设置选中和未选中的图片... ViewControllerThree *vc3 = [[ViewControllerThree alloc] init]; vc3.title = @"发现"; //... ViewControllerFour *vc4 = [[ViewControllerFour alloc] init]; vc4.title = @"我"; //... NSArray *viewControllers = [NSArray arrayWithObjects:vc1, vc2, vc3, vc4, nil]; tabBarController.viewControllers = viewControllers; UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:tabBarController]; self.window.rootViewController = nc; [self.window setTintColor:[UIColor greenColor]]; [self.window makeKeyAndVisible]; return YES;}
demo 截图
0 0
- iOS 多个 tab 页 demo
- iOS 109个Demo范例
- tab切换,适用于多个tab切换
- 使用腾讯TAB做成的第一个demo
- IOS tab页跳转
- TabWidget 添加多个tab
- 在浏览器的多个tab页中共享sessionStorage
- PHP个推for iOS demo实例
- 我的第一个iOS Demo
- Appium之IOS第一个demo
- tab标签导航demo
- Extjs应用tab页的最简单Demo
- xshell 不能显示多个tab
- easyUI 多个tab乱跳问题
- qt使用tab管理多个界面
- tx6-多个tab栏切换闭包版
- selenium--检查多个tab下商品价格
- Demo for Android Tab Widget
- 图像滤镜艺术---(Instagram)1977滤镜
- [安全]DDOS攻击[分布式拒绝服务攻击]
- html css 图片居中
- (标记)深入理解javascript作用域和闭包
- win10配置java环境变量,解决javac不是内部或外部命令等问题
- iOS 多个 tab 页 demo
- Leetcode: Wiggle Sort
- UVa 12558:Egyptian Fractions (HARD version)(IDA*)
- JDK 1.7源码阅读笔记(七)集合类之HashMap
- 注意uiview的两个重绘函数
- 你应该掌握的七种回归技术
- Java知识总结----事件处理机制(九)
- UI中一系列 个人错误总结
- hdu acm 2159 FATE