UIView Animation iPhone (obtaining information on the frame dynamically)
Posted
by Urizen
on Stack Overflow
See other posts from Stack Overflow
or by Urizen
Published on 2010-03-23T13:40:30Z
Indexed on
2010/03/23
13:43 UTC
Read the original article
Hit count: 392
I have a UIView
called goalBar which is being animated by increasing the size of the frame according to a float value called destination:
CGRect goalBarRect = CGRectMake(0, 0, destination, 29);
[UIView beginAnimations:@"goal" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:2.0f];
goalBar.frame = goalBarRect;
[UIView commitAnimations];
The animation works perfectly and the rectangular view increases its width over the course of the animation (from 0 to the value for destination).
However, I wish to be able to extract the values for the frame of the UIView
being animated (i.e. goalBar) as the animation takes place. By that I mean that I wish to place the value of the width for the animated frame in a separate UILabel
so that the user sees a counter that provides the width of the UIView
as it's being animated.
Any help on how to do the above would be gratefully received.
© Stack Overflow or respective owner