I have a few buttons I would like to animate.
I have looked at and tried the animateWithDuration method but that seems to be for Views and I couldnt get my implementation to work.
Can this method work for animating buttons too? if not how could it be done?
EDIT I have the following code
-(void) animate:(UIButton*) b withMonster: (int) monster withState: (int) state andLastState:(int) last_state {
if (state < last_state) {
float duration = 1.0 / 10;
__block int stateTemp = state;
[b animateWithDuration: duration
animations: ^{ [UIImage imageNamed:[NSString stringWithFormat:@"m%d.a000%d.png", monster, state]]; }
completion: ^{ [self animate: A1 withMonster: monster withState: stateTemp++ andLastState: last_state];; }];
}
and I call it like so
[self animate: A1 withMonster: monsterDecider withState: 1 andLastState: 5];
When this code executes the app crashes.
Is it correct to call is with self in both calls(self being ViewController).
Thanks