Reputation: 1393
I have a UIView object. It rotates when I change global variable angle. I have a function that removes this UIView from it's superview and redraws it. I have added a button. When user presses this button I need to launch an animation. In every step I need to change the angle and call my redraw function. So so effect I'm expecting to see is that my view is rotating. here's the code:
-(IBAction)animate:(id)sender
{
NSLog(@"animate: called");
[UIView animateWithDuration:0.7
delay:0.0
options: UIViewAnimationCurveEaseOut
animations:^{
angle=angle+5.0;
if (angle>360)
{
angle=angle-360;
}
else if(angle<0)
{
angle=angle+360;
};
NSLog(@"inner angle: %g", angle);
[self transform]; //this is my redraw function. it redraws my view depending on global variable value angle.
}
completion:NULL];
NSLog(@"finalAngle: %g", angle);
}
Why this animation does not working normally?
Upvotes: 1
Views: 2082
Reputation: 1
You can animate the transform property. However, to perform a rotation with the transform property is more complex than using the CA Framework. I found this post helpful: UIView Infinite 360 degree rotation animation?
Upvotes: 0
Reputation: 1957
UIView animation only supports the following properties
@property frame
@property bounds
@property center
@property transform
@property alpha
@property backgroundColor
@property contentStretch
you have to perform the animation with core animation framework
Upvotes: 1