Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 带有loginViewController的xcode选项卡式应用程序_Ios_Uitabbarcontroller - Fatal编程技术网

Ios 带有loginViewController的xcode选项卡式应用程序

Ios 带有loginViewController的xcode选项卡式应用程序,ios,uitabbarcontroller,Ios,Uitabbarcontroller,我对xcode相当陌生,所以如果我问了一些不好的问题,我深表歉意。我的问题是,我已经创建了一个选项卡式应用程序,但希望在显示选项卡之前显示一个登录屏幕。关于这一点有很多帖子,大家一致认为需要让tabBarController展示一个视图控制器。这是有道理的,但由于某些原因,我的应用程序没有显示登录屏幕。我将在下面粘贴我的appDelegate.m代码。任何帮助都将不胜感激 Tks 您应该在第一个选项卡中的控制器上进行演示(假设在注销登录屏幕后您要显示的控制器)。从ViewDidDisplay方法

我对xcode相当陌生,所以如果我问了一些不好的问题,我深表歉意。我的问题是,我已经创建了一个选项卡式应用程序,但希望在显示选项卡之前显示一个登录屏幕。关于这一点有很多帖子,大家一致认为需要让tabBarController展示一个视图控制器。这是有道理的,但由于某些原因,我的应用程序没有显示登录屏幕。我将在下面粘贴我的appDelegate.m代码。任何帮助都将不胜感激

Tks


您应该在第一个选项卡中的控制器上进行演示(假设在注销登录屏幕后您要显示的控制器)。从ViewDidDisplay方法执行演示,将动画参数设置为NO.

尝试将
\u tabbar controller
更改为
self.tabbar controller
,并将
presentViewController
调用移动到
makeKeyAndVisible
之后。。。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    sleep(3);
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.
    LoginViewController *loginViewController = [[[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil] autorelease];
    UIViewController *viewController1 = [[[SecondViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
    UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];

    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    self.tabBarController.viewControllers = @[viewController1, viewController2];

    self.window.rootViewController = self.tabBarController;

    [loginViewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
    [_tabBarController presentViewController:loginViewController animated:YES completion:nil];

    [self.window makeKeyAndVisible];
    return YES;
}