登录页面跳转到首页(含有tabBar)
2015-09-07 15:20
330 查看
自定义tabBar类
在customTabBarCtrl.h中
在customTabBarCtrl.m中
在登录页面中,点击登录跳转的方法中执行下面代码
在customTabBarCtrl.h中
<span style="font-size:14px;">#import <UIKit/UIKit.h> @interface customTabBarCtrl : UITabBarController @end</span>
在customTabBarCtrl.m中
<span style="font-size:14px;">#import "customTabBarCtrl.h" #import "mainViewController.h" #import "loveViewController.h" #import "mineViewController.h" @implementation customTabBarCtrl - (void)viewDidLoad{ [super viewDidLoad]; [self dismissViewControllerAnimated:NO completion: nil];</span>
<span style="font-size:14px;"> UINavigationController *nav;</span>
<span style="font-size:14px;"> UIViewController *mainVC = [[mainViewController alloc]init]; nav = [[UINavigationController alloc] initWithRootViewController: mainVC]; nav.tabBarItem.image = [UIImage imageNamed:@"首页-灰色.png"]; nav.tabBarItem.selectedImage = [UIImage imageNamed:@"首页-绿色.png"]; nav.tabBarItem.title = @"首页"; [self addChildViewController: nav]; UIViewController* loveVC = [[loveViewController alloc] init]; nav = [[UINavigationController alloc] initWithRootViewController: loveVC]; nav.tabBarItem.image = [UIImage imageNamed:@"爱心-灰色.png"]; nav.tabBarItem.selectedImage = [UIImage imageNamed:@"爱心-绿.png"]; nav.tabBarItem.title = @"爱心"; [self addChildViewController: nav]; UIViewController* VC3 = [[UIViewController alloc] init]; nav = [[UINavigationController alloc] initWithRootViewController: VC3]; nav.tabBarItem.image = [UIImage imageNamed:@"亲情-灰色.png"]; nav.tabBarItem.selectedImage = [UIImage imageNamed:@"亲情-绿色.png"]; nav.tabBarItem.title = @"亲情"; [self addChildViewController: nav]; UIViewController* mineVC = [[mineViewController alloc] init]; nav = [[UINavigationController alloc] initWithRootViewController: mineVC]; nav.tabBarItem.image = [UIImage imageNamed:@"我的-灰色.png"]; nav.tabBarItem.selectedImage = [UIImage imageNamed:@"我的-绿色.png"]; nav.tabBarItem.title = @"我的"; [self addChildViewController: nav];</span>
} -(void)viewWillAppear:(BOOL)animated{ self.navigationController.navigationBarHidden = YES; }
在登录页面中,点击登录跳转的方法中执行下面代码
<span style="font-size:14px;">UITabBarController *tabBarCtrl = [[customTabBarCtrl alloc]init]; [self presentViewController:tabBarCtrl animated:NO completion:nil];</span>
相关文章推荐
- android 源码启动camera
- 断点续存
- android sparseArray源码解析
- 多态
- Hadoop性能调优
- Linux_5day------------使用crontab调度命令
- JSP url Mapping
- Python 日期时间
- 关于NSArray 排序的问题
- Caffe学习笔记1-安装以及代码结构
- 如何从源代码构建 Go 1.5 开发环境
- poj 1144 Network 图的连通性-关节点个数
- Light oj 1037 - Agent 47(状压dp)
- java集合框架
- Keys and Commands
- poj 1144 Network 图的连通性-关节点个数
- moosefs2.0-安装(1)
- 使用Cardme读取安卓IOS导出的vcf格式通讯录
- leetcode-25 Reverse Nodes in k-Group
- 回调函数