2012-08-15 71 views
0

我收到此警告,但沒有線索我做錯了什麼,它是一個簡單的代碼來更改視圖與轉換。我沒有使用Xcode 3.x中的這個錯誤,但現在使用4.x時,問題開始了。儘管這只是一個警告,代碼編譯完美,但我想知道問題所在。獲取此警告:不兼容的指針類型初始化'*'與類型爲'*'的表達式

-(IBAction)swapViews:(id)sender{ 
DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 
view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:view3 animated:YES];} 

感謝所有您的幫助

回答

1
//DemoViewController* ThirdViewController* ???? 
//the warning is in this line 
DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 
view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:view3 animated:YES]; 

我想你想在這裏做的是什麼。

ThirdViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 
+0

我正要對着電腦砸我的頭。那做了這個工作。非常感謝! – Andres 2012-08-15 10:14:26

+0

非常歡迎兄弟:) – janusbalatbat 2012-08-15 10:14:55

0

你忘了大括號嗎?

-(IBAction)swapViews:(id)sender { 
    DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 
    view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:view3 animated:YES]; 
} 
+0

對不起,已經編輯過,但沒有引起警告。 – Andres 2012-08-15 10:13:16

相關問題