I am trying to convert some animation code that uses beginAnimations to use animation blocks. The problem I am facing is that when I use animation blocks, the animations go much faster and I can’t adjust the speed by changing the duration value
This is where I started initially:
birdFly.image = [UIImage imageNamed: @"bird1.png"];
[self.view addSubview:birdFly]
[UIView beginAnimations:nil context:NULL]
[UIView setAnimationDuration:20]
birdFly.frame = CGRectMake(-1116,27,111,48);
[UIView commitAnimations]
[birdFly release]
This is what I tried to first replace with what I had above. Using this code, the animation is much faster than using the source code. Even changing the duration does not change the speed at all:
birdFly.image = [UIImage imageNamed: @"bird1.png"];
[self.view addSubview:birdFly]
[UIView animateWithDuration:20
animations:^{
birdFly.frame = CGRectMake(-1116,27,111,48);
}]
I also tried this, thinking that I needed a completion block, but the speed was still as fast compared to what I originally had when I did not use blocks.
birdFly.image = [UIImage imageNamed: @"bird1.png"];
[self.view addSubview:birdFly];
UIViewAnimationOptions options = UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction;
[UIView animateWithDuration:20 delay:0.0 options:options animations:^
{
birdFly.frame = CGRectMake(-1116,27,111,48);
} completion:nil];
, ? - ? , , , , , .
.
.