-(IBAction) change {
self.imageView.animationImages = myImages;
self.imageView.animationDuration = 2;
if(self.imageView.isAnimating == NO){
[self.imageView startAnimating];
NSLog(@"if bool = %d", self.imageView.isAnimating);
}
else {
self.imageView stopAnimating];
NSLog(@"else bool = %d", self.imageView.isAnimating);
}
}
hello, i’m studying iOS programming.
but i have a question.
i have a button and when i click the button, then this method will be called.
first i click the button, then this code will start the if statement. that’s what i want.
i click the button again, i think that will execute the else statement.
but it always execute the if statement only.
why is that?
i really don’t know why is that. please help me
I think setting the properties like
animationImagesoranimationDurationwill stop the animation, so that by clicking, you every time stop and then just after (re)start it in the if part. Try setting these two properties outside the action method you wrote, and just let the if/else sequence.