gpt4 book ai didi

iphone - 在选项卡 Controller View 之前显示登录屏幕

转载 作者:行者123 更新时间:2023-12-01 17:16:40 27 4
gpt4 key购买 nike

我有一个 tabBarController 应用程序并使用 .xib 文件作为界面而不是 Storyboard
默认情况下,我在 appdelegate 中有此代码

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[PopAdsFirstViewController alloc] initWithNibName:@"PopAdsFirstViewController" bundle:nil];

UIViewController *viewController2 = [[PopAdsSecondViewController alloc] initWithNibName:@"PopAdsSecondViewController" bundle:nil];

self.tabBarController = [[UITabBarController alloc] init];

self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];

self.window.rootViewController = self.tabBarController;

[self.window makeKeyAndVisible];

return YES;

我创建了一个登录 View ,但不知道如何在 tabBarView 之前显示它并在成功登录后隐藏 t。

最佳答案

一种方法是在启动时将其显示为 modalView。登录成功后退出?
例如:

UIViewController myLoginViewController = [[MyLoginViewController alloc] init withNibNamed:"MyLoginViewController"]; //Or whatever you instantiation is
[myTabViewController presentModalViewController:myLoginViewController animated:YES];

并解雇它(隐藏它)
//This should be done from the original View Controller i.e. myTabViewController preferably in a delegate called by the modal view controller.
[self dismissModalViewControllerAnimated:YES];

关于 modalViewControllers 的文档:
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

关于iphone - 在选项卡 Controller View 之前显示登录屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8590254/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com