我有一个像这样的瓷砖对象
- (id)initWithFrame:(CGRect)frame withImageNamed:(NSString*) imageName value:(int) tileValue{
if (self = [super initWithFrame:frame]) {
//initilization code
image = [[UIImageView alloc]
initWithImage: [UIImage imageNamed: imageName]];
image.frame = self.bounds;
image.opaque = YES;
[self addSubview:image];
valueOfTile = tileValue;
} return self;
}
我正在尝试创建一个对象:
tile1 = [[TileView alloc]
initWithFrame:CGRectMake(20,20, 100, 150)
value:1
withImageNamed:@"tile1.png"];
当我没有添加值信息时,我能够让它工作,但现在它给了我这个错误:实例方法'-initWithFrame:value:withImageNamed:' not found (return type defaults to 'id')
我不确定我在哪里出错了。