我想通过计时器更改我的自定义UIImageView子类的图片。但它不起作用。你能救我吗?
这是我的代码:
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self update];
}
return self;
}
-(void)update {
self.image = [UIImage imageNamed:@"Green.png"];
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(change) userInfo:nil repeats:YES];
}
-(void)change {
self.image = [UIImage imageNamed:@"Red.png"];
}
谢谢!