TabbarController的封装
来源:互联网 发布:红米手机壳淘宝 编辑:程序博客网 时间:2024/06/05 20:27
首先建立一个类继承自UITabBarController
.m中实现代码:
- (void)viewDidLoad { [super viewDidLoad]; ViewController *firstVc = [[ViewController alloc] init]; [self addChildVc:firstVc title:@"你好" image:@"mengmeng" selectedImage:@""]; SecondViewController *secondVc = [[SecondViewController alloc] init]; [self addChildVc:secondVc title:@"hello" image:@"jiyi" selectedImage:@""];}- (void)addChildVc:(UIViewController *)childVC title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{ childVC.title = title;//同时设置tabBar和navgationBar的文字 //设置控制器的图片 childVC.tabBarItem.image = [UIImage imageNamed:image]; childVC.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage]; //设置导航控制器 UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVC]; //添加为子控制器 [self addChildViewController:nav];}
在AppDelegate中
self.window.rootViewController = [[QZTabBarController alloc] init];
就可以了
阅读全文
0 0
- TabbarController的封装
- tabBarController 的隐藏问题
- TabBarController的使用
- tabbarController的使用
- TabBarController
- TabBarController
- tabBarController
- TabBarController
- tabbarController
- TabBarController
- TabBarController
- tabBarController的外观的设置
- iOS 会跳舞的TabbarController
- 自定义一个自己的tabbarController
- (六)TabBarController的简单自定义
- tabbarController之间的跳转(有一个tabbarcontroller上的button跳转到另一个tabbarcontroller)
- Swift3.0 TabbarController封装并添加动画效果
- 自定义的tabBarController的几种方法
- Discuz3.3搭建在Docker环境
- Java中静态块、静态变量执行步骤详解
- 悲观锁和乐观锁
- Python股票处理之二_数据存盘
- eclipse中DeplaymentAssembly,Java Build Path,Java Compiler,Project Facets的作用
- TabbarController的封装
- Entity Framework 6 Code First新特性:支持存储过程
- Android 蓝牙的基本使用方法
- Python 获得命令行参数的方法
- Person Re-identification Overview
- 如何从另一个PPT中提取母版(WPS)
- 测试那点事--小结
- Spring MVC统一异常处理:HandlerExceptionResolver
- MyBatis插件及示例----打印每条SQL语句及其执行时间