2010-05-18 53 views
1

嘿即時嘗試顯示模式視圖控制器,只要我的標籤欄控制器應用程序打開。modalViewController當應用程序打開時顯示

下面的代碼有問題,而且99%肯定它的代碼。我爲什麼要把它叫做什麼?

[self presentModalViewController:promt animated:YES]; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

// Override point for customization after app launch. 


//Displays the password prompt modally 

PasswordPromViewController *promt = [[PasswordPromViewController alloc] initWithNibName:@"PasswordPromViewController" bundle:nil]; 
promt.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:promt animated:YES]; 
[promt release]; 






return YES; 
} 

任何想法都會很有幫助! 乾杯

回答

1

我猜你正在應用程序委託文件中添加此代碼(例如,如果你的應用程序被稱爲XXX然後XXXAppDelegate.m)。如果出現這種情況,您不能使用:

[self presentModalViewController:promt animated:YES]; 

因爲必須在UIViewController的實例上調用此方法。如果你已經以標準的方式設置你的項目,那麼你的應用程序委託應該有一個叫做window的對象,它是對應用程序主窗口的引用。這可能是最簡單的,如果你添加模態視圖控制器,如下所示:

[window presentModalViewController:promt animated:YES]; 
相關問題