2011-01-18 13 views
0

私はメインビューコントローラを別のインスタンスとして作成し、提示しています。 *互換性のないObjective-Cの種類」構造体MainViewControllerを:フォワードクラスがあり、対応する@interfaceがUIViewControllerを表示する際の警告

警告が存在しないことがあり、受信機 'MainViewController'

MainViewController *sm = [[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil]; 
[self presentModalViewController:sm animated:NO]; 
[sm release]; 

この

は、次のエラー

警告を与えます'、予想される' struct UIViewController * '' presentModalViewController:animated: 'の引数1を別のObjective-Cタイプから渡すとき

私は間違って何をしていますか?存在するMainViewControllerの現在のバージョンをどのように表示できますか?

答えて

4

あなたのヘッダファイルに

@class MainViewController; 

を前方宣言を持っていますが、実装ファイルのヘッダファイルをインポートしないでください。

は、.mファイルの先頭に

#import "MainViewController.h" 

を追加します。

0

"MainViewController.h"

.mファイルにインポートします。

+0

ビルはすでに感謝してくれた。 – jarryd

関連する問題