0

我需要在按鈕單擊時顯示來自rootviewcontroller的另一個視圖。我寫了下面的代碼,但它不起作用。任何想法爲什麼?在iOS中不工作呈現模態視圖控制器

在我的應用程序的委託方法我有下面的代碼 -

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 
// Override point for customization after application launch. 
self.viewController = [[[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil] autorelease]; 

self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 
return YES; 
} 

然後在我的mainviewcontroller我有這應該帶我去一個不同類別的按鈕動作,但它什麼都不做。儘管nslog語句起作用,但按鈕操作仍在工作。有任何想法嗎?

LoginViewController * loginViewController = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil]; 
    [self.modalViewController presentModalViewController:loginViewController animated:YES]; 
NSLog(@"HE::P"); 
+1

這是什麼'modalViewController'財產?不應該是'[self presentModalViewController ...]'? – albertamg 2012-07-13 15:31:40

回答

2

如果你嘗試:

[self presentModalViewController:loginViewController animated:YES]; 
相關問題