先登录 在跳转到tabBar
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
// 第二步:创建UITabBarController对象
self.mainTab = [[UITabBarController alloc] init];
// 第三步:设置window的根视图控制器
self.window.rootViewController = self.mainTab;
UINavigationController *loginVC = [[UINavigationController alloc] initWithRootViewController:[[LoginViewController alloc] init]];
loginVC.navigationBarHidden = YES;
[self.mainTab presentViewController:loginVC animated:NO completion:nil];
// 控制器
UINavigationController *homeNVC = [[UINavigationController alloc] initWithRootViewController:[[HomeViewController alloc] init]];
// 设置图片
homeNVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[[UIImage imageNamed:@"tb_08"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tb_09"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *classNVC = [[UINavigationController alloc] initWithRootViewController:[[ClassifyViewController alloc] init]];
// 设置图片
classNVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"分类" image:[[UIImage imageNamed:@"tb_05"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tb_03"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *shoppingNVC = [[UINavigationController alloc] initWithRootViewController:[[ShoppingCarViewController alloc] init]];
// 设置图片
shoppingNVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"购物车" image:[[UIImage imageNamed:@"tb_06"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tb_01"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *userNVC = [[UINavigationController alloc] initWithRootViewController:[[UserViewController alloc] init]];
// 设置图片
userNVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"个人中心" image:[[UIImage imageNamed:@"tb_07"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tb_02"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
// 将导航控制器对象添加到数组中
self.mainTab.viewControllers = @[homeNVC,classNVC,shoppingNVC,userNVC];
return YES;
}
先登录 在跳转到tabBar的更多相关文章
- Struts2透过自定义拦截器实现登录之后跳转到原页面
Struts2通过自定义拦截器实现登录之后跳转到原页面 这个功能对用户体验来说是非常重要的.实现起来其实很简单. 拦截器的代码如下: package go.derek.advice; import g ...
- Spring Security4.1.3实现拦截登录后向登录页面跳转方式(redirect或forward)返回被拦截界面
一.看下内部原理 简化后的认证过程分为7步: 用户访问网站,打开了一个链接(origin url). 请求发送给服务器,服务器判断用户请求了受保护的资源. 由于用户没有登录,服务器重定向到登录页面 填 ...
- VUE实现登录然后跳转到原来的页面
可以在路由里面设置需要登录的界面,判断下没有登录就跳转到登录界面,登录了就不用登录,这里用的是一个存储的 router.beforeEach((to, from, next) => { if(t ...
- Mvc校验用户没有登录就跳转的实现
看字面意思很简单,就是判断用户是否登录了,如果没有登录就跳转到登陆页面. 没错,主要代码如下(这里就不写判断登录了,直接跳转) 首先在控制器中新建一个BaseController public cla ...
- Vue router拦截 如果用户并未登录直接跳转到登录界面(最简单的cookie演示)
router.beforeEach(function(to,from,next){ console.log('路由拦截') console.log(to.name) console.log(from. ...
- 处理Oracle EBS R12登录首页跳转出现unexpected error问题(转)
原文地址: 处理Oracle EBS R12登录首页跳转出现unexpected error问题 经上网搜索,造成此问题的问题有很多,如内存不足.系统参数配置不当.程序代码.系统表空间不足等原因.查询 ...
- 关于WordPress登录后跳转到指定页面
前面在写模版的时候,有朋友要求网站登录后要跳转的到指定的页面.这个从前还真没遇到过.于是就用万能的搜索(很少百度)找了下,方法基本上就是一个,代码如下: <?php // Fields f ...
- Django 实现登录后跳转
说明 实现网页登录后跳转应该分为两类:即登录成功后跳转和登录失败再次登录成功后跳转.参考网上内容,基本都只实现了第一类.而没有实现第二类. 实现 为了能让登录失败后再次登录成功后还能实现跳转.我这里采 ...
- wordpress注册、登录后跳转到首页
只想注册后跳转到首页 function new_login_redirect() { return '这里换成首页地址'; } add_action( 'user_register', 'auto_l ...
随机推荐
- 用例图(UseCase Diagram)—UML图(一)
从上面的用例图模型,我们可以大致了解用例图所描述的是什么.下面进行详细介绍. 用例图,即用来描述什么角色通过某某系统能做什么事情的图,用例图关注的是系统的外在表现,系统与人的交互,系统与其它系统的 ...
- c++ 学习备忘
char* 到 LPCTSTR 转换 char *m_str = "test!"; MessageBoxW(CString(m_str)); CString to LPCTSTR ...
- Problem F: Exponentiation大数求幂
DescriptionProblems involving the computation of exact values of very large magnitude and precision ...
- C#学习日志 day 1 ------ hello C# !
首先是C#的编译器的安装.这里用vs2013.我用的是Windows 8.1系统,所以安装起来并不难. 双击vs_ultimate.exe 逐步安装就好.这里用校园邮箱在dream spark 上进行 ...
- HTML5速查表
HTML5速查表 标签 描述 版本 属性 <!--...--> 定义注释 4 / 5 none <!DOCTYPE> 定义文档类型 4 / 5 none <a> 定 ...
- Windows phone 8.1 MessageBox 变了哦!
using Windows.UI.Popups; public async void MessageBoxShow(string content, string caption) { MessageD ...
- 专访CEO何朝曦:深信服高速成长的秘诀
在深信服公司深圳总部的办公室里,要迅速找到几位高管的工位远远不如找一位女员工的座位那样容易. 深信服CEO何朝曦先生 公司里虽然女孩很少,但几乎每位女员工的工位上都有一盆绿植.相比之下,从公司CEO何 ...
- Ubuntu 麒麟版下安装:Apache+php5+mysql+phpmyadmin.
摘要 LAMP是Linux web服务器组合套装的缩写,分别是Apache+MySQL+PHP.此文记录在Ubuntu上安装Apache2服务器,包括PHP5(mod_php)+MySQL+phpmy ...
- 【解决方法】You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)
出现场景: 正常调试是没有问题的,但是在Archive的时候,报出了这个错误. 问题详情: (null): URGENT: all bitcode will be dropped because ‘x ...
- 【玩转Ubuntu】04. Ubuntu上配置git环境
1. 使用PPA安装Git PPA,表示 Personal Package Archives,也就是个人软件包集. 有很多软件因为种种原因,不能进入官方的 Ubuntu 软件仓库. 为了方便 Ubun ...