如果用户打开应用程序,然后在最后tabbar
项目上选项卡,则会将他带到login viewcontroller
,以下是有效的。用户注册或输入他的凭据,然后他就能看到他的profile view controller
。 TabBar[4]
表示TabBar
TabBar [4] -> Nav Controller ->Login -> User Profile
但是,如果用户已经注册或登录,我怎么能直接打开用户Profile ViewController
,换句话说,我怎么能跳过Login viewcontoller
?
TabBar [4] -> Nav Controller -> User Profile
答案 0 :(得分:0)
您也应该跳过初始化Nav Controller
当用户登录时,User Profile
应该直接是TabBar的成员。
考虑一些代码,如:
UITabBarController *tabBar = [[UITabBarController alloc] init];
// FirstViewController
First *firstVC = [[First alloc]init];
firstVC.title = @"First";
firstVC.tabBarItem.image = [UIImage imageNamed:@"1.png"];
//SecondViewController
Second *secondVC = [[Second alloc] init];
secondVC.title = @"Second";
secondVC.tabBarItem.image = [UIImage imageNamed:@"2.png"];
//ThirdViewController
Third *thirdVC = [[Third alloc] init];
thirdVC.title = @"Third";
thirdVC.tabBarItem.image = [UIImage imageNamed:@"3.png"];
//The User Profile Screen
UserProfileVC *userProfile = [[UserProfileVC alloc] init];
userProfile.title = @"User Profile";
userProfile.tabBarItem.image = [UIImage imageNamed:@"4.png"];
tabBar.viewControllers = @[firstVC, secondVC, thirdVC, userProfile];