【发布时间】:2023-03-31 15:45:01
【问题描述】:
我有一个基于带有欢迎屏幕的标签栏视图的应用程序(导致登录或注册过程)。基本上,如果您已登录 - 您直接进入标签栏视图,如果没有,您将进入欢迎屏幕,您可以在其中选择登录或注册。假设您去登录或注册,我希望标签栏视图重新出现,但是,所有声明都在 AppDelegate 中。我怎样才能“返回”并调用 tabbatcontroller?我的课程结构/流程是否正确?
重复一遍:
- 用户登录 -> 第一个视图是标签栏视图
- 用户退出 -> 欢迎屏幕视图 -> 登录/向上屏幕视图 -> 选项卡栏视图
我正在寻找的是我需要在这个动作方法中写什么,一旦用户在登录页面中点击“登录”就会被调用:
-(IBAction)done:(id)sender {
?????
}
作为参考,我的 appDelegate 是:
if(user signed in)
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *viewController1 = [[FirstTab alloc] initWithNibName:@"FirstTab" bundle:NSBundle.mainBundle];
UIViewController *viewController2 = [[SecondTab alloc] initWithNibName:@"SecondTab" bundle:NSBundle.mainBundle];
UINavigationController *secondNavController = [[UINavigationController alloc]initWithRootViewController:viewController2];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, secondNavController, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
}
else
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SigninTabBarTemplateViewController *landingPage = [[SigninTabBarTemplateViewController alloc] initWithNibName:@"SigninTabBarTemplateViewController" bundle:nil];
self.window.rootViewController = (UIViewController *) landingPage;
[self.window makeKeyAndVisible];
}
【问题讨论】:
标签: objective-c xcode uiviewcontroller uinavigationcontroller uitabbarcontroller