[英]xcode tabbed application with loginViewController
我對xcode相當陌生,所以如果我問壞問題,我深表歉意。 我的問題是我已經創建了一個選項卡式應用程序,但是希望在選項卡顯示之前顯示一個登錄屏幕。 關於此的文章很多,共識是您需要獲取tabBarController來呈現視圖控制器。 這是有道理的,但由於某種原因,我的應用程序未顯示登錄屏幕。 我將在下面粘貼我的appDelegate.m代碼。 任何幫助將非常感激。
ks
- (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;
}
您應該在第一個選項卡中的控制器上進行演示(假設這是您要在關閉登錄屏幕后顯示的控制器)。 通過將animated參數設置為NO的viewDidAppear方法進行演示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.