Tween value in iPhone objective-C
Is it possible to tweak a variable (say float from 0.0 to 2.0 over a period of time) in objective-C? Something like what TweenMax would do in flash. I think the methods of the UIView class don't do this. Is this possible with CoreAnimation? Or should someone be using NSTimer?
thank
source to share
Use a selector NSTimer
that increments the value of the member variable from an initial value of 0.0 by the increment value.
When the variable reaches the endpoint (2.0), the invalidate
instance NSTimer
to end increment.
For more information on the method used, see the documentation .
source to share
What do you do? If you are trying to spice things up, you can use a CA and it will handle calculating intermediate values ββover time.
If you are trying to do something not related to views or animations, you will need to do it yourself (using a timer or a custom property implementation that dynamically calculates the value based on the current time when it is accessed).
source to share