0
我對xcode相當陌生,所以如果我提出不好的問題,我很抱歉。我的問題是我創建了一個選項卡式應用程序,但希望在顯示選項卡之前顯示一個登錄屏幕。有很多關於這個的帖子,共識是你需要讓你的tabBarController呈現一個視圖控制器。這是有道理的,但由於某種原因,我的應用程序不顯示登錄屏幕。我將在下面粘貼我的appDelegate.m代碼。任何幫助將非常感激。xcode與loginViewController的選項卡式應用程序
韓國社交協會
- (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;
}
嘗試將'_tabBarController'更改爲'self.tabBarController'並將'presentViewController'調用移動到'makeKeyAndVisible'之後... – jjv360
工作正常! – Richie