I have the following code
-(void) animate:(UIButton*) b withState: (int) state andLastState:(int) last_state {
if (state < last_state) {
int stateTemp = state;
float duration = 1.0 / 30.0;
[b animateWithDuration: duration
animations: ^{ [UIImage imageNamed:[NSString stringWithFormat:@"m1.a000%d.png", state]]; }
completion: ^{ animate(b, stateTemp++, last_state); }];
}
}
but get an error increment of read-only variable 'stateTemp'
I am trying to animate a series of images by setting a UIButtons image.
What is wrong with this code?
Thanks