2012-01-14 8 views
0

を破った、これは私のHEADERFILE ViewController.hはもう型としてのカスタムクラスを使用することはできません - 何かが、私は奇妙な問題を抱えている

#import <UIKit/UIKit.h> 
#import "MapField.h" 

@interface ViewController : UIViewController{ 
IBOutlet UIView *simField; 
IBOutlet UISegmentedControl *segmentControl; 
IBOutlet UILabel *timeLabel; 
double fieldAlpha; 
IBOutlet UISlider *alphaSlider; 
double tickTime; 
int totalNumberOfCars; 
} 

/*shortened, here are the property ... declarations usually */ 

-(MapField*)findDepartureField; 
-(MapField*)findDestinationField; 

あるクラスMapField.hは以下のようになります。

#import <UIKit/UIKit.h> 
#import "ViewController.h" 


@interface MapField : UIImageView{ 
    UIViewController *delegate; 
    int x; 
    int y; 
    int numberOfCars; 
    double wAb; 
    double wAn; 
    int dFahrtdauer; 

} 


@property (nonatomic) int x; 
@property (nonatomic) int y; 
@property (nonatomic) int numberOfCars; 
@property (nonatomic) double wAb; 
@property (nonatomic) double wAn; 
@property (nonatomic) int dFahrtdauer; 
@property (nonatomic, retain) UIViewController *delegate; 


-(void)setDisplayMode:(int)mode; 


@end 

-(MapField*)findDepartureField; 
-(MapField*)findDestinationField; 

エラー:

は、しかし、私はこの2行でViewController.hに奇妙なエラーを取得し、正常に見えると細かい常に働いEをタイプを特定しました(そして、MapFieldは赤くマークされています)。

私はそれを取得しません。私は何千回もチェックした。それは動作する必要があります!他にどこかの奇妙なエラーがあるはずです!

答えて

0

@interface ViewControllerの呼び出しのすぐ上に@class MapFieldを追加すると、コンパイラにはい、クラスであることが伝えられます。

0

MapFieldから削除し、必要に応じて@class ViewControllerを追加すると機能します。私にとって、問題は.hファイルの循環参照であり、ViewController.hへの参照は不要と思われる。必要に応じて、 ViewControllerクラスの前方宣言を使用できます。

関連する問題