2011-06-30 63 views
2

在我的應用程序委託中,我想爲應用程序第一次啓動顯示註冊屏幕。ModalViewController只顯示動畫

這裏是我的代碼:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
self.window.rootViewController = self.tabBarController; 
[[[self.tabBarController.tabBar items] objectAtIndex:2] setEnabled:NO];  
[[[self.tabBarController.tabBar items] objectAtIndex:3] setEnabled:NO]; 

if (![self checkAuth]) { 
    SignupViewController * signUp = [[SignupViewController alloc] initWithNibName:@"SignupView" bundle:nil] ; 
    [signUp setManagedObjectContext:self.managedObjectContext]; 
    [[self tabBarController] presentModalViewController:signUp animated:YES] ; 
    [signUp release] ; 
} 
[self.window makeKeyAndVisible]; 
return YES;} 

一切工作正常,但我不希望我的modalViewController進行動畫...

當我改變行:

[[self tabBarController] presentModalViewController:signUp animated:YES] ; 

用於:

[[self tabBarController] presentModalViewController:signUp animated:NO] ; 

我的基礎tabBarController被顯示,我的modalViewController沒有出現!

我花了很多時間來搜索有人用類似的問題,但我沒有找到任何解決辦法...

有人能幫助我嗎?

回答

0

嘗試在presentModalViewController之前調用[self.window makeKeyAndVisible];

+0

這就是解決方案!有用。非常感謝。你知道爲什麼嗎 ? – Julien

+0

我想動畫==是有一點延遲,同時呈現modalView,使窗口可見之前真正添加modalView。如果animated == NO,那麼當窗口不可見並且被忽略時,將添加modalView。 – AlexVogel

+0

好的,非常感謝你的解釋! – Julien