我有一個奇怪的問題,這是我的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
看起來很好,總是能正常工作,但我在ViewController.h得到一個奇怪的錯誤在這兩條線:
-(MapField*)findDepartureField;
-(MapField*)findDestinationField;
錯誤:電子xpected一個類型(並且MapField標記爲紅色)。
我不明白。我檢查了一千次。它必須工作!其他地方肯定會出現一些奇怪的錯誤!