Well, I want to make a animation application on iOS. So, I make an application using UIViews… But, it’s very complicated. There are so many UIViews so I want to make it simple. So, There’s any way to make an animation just using CGContext just one UIView? If someone knows PLS help.
Share
You could use a timer that repeatedly fires so you call setNeedsDisplay every 0.01 second or something, and calculate every rectangle, circle, line, whatever to the right places at every time instant. You may well suffer some issues this way, though, since drawRect won’t get called instantly every time, meaning you’ll need to check the actual time when drawRect fires. You might even need to take the time it takes to execute your code into account.
Or just move the UIViews around in stead, using animateWithDuration:. I recommend that. No matter how complex your hierarchy is, doing it all in a single view will always be more complex.