我有一个奇怪的问题,这是我的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标记为红色)。
我不明白。我检查了一千次。它必须工作!其他地方肯定会出现一些奇怪的错误!