I'm curious as to the 'proper' method for achieving the following functionality using Quarts2D:
I want to have a view, and to be able to add a circle at any coordinate. As soon as I add the circle it should expand at a predefined rate; I'd also like to repeat this process and have a number if these expanding circles.
Think Missile Command:
Generally, if I was writing this in C++ using SDL or some other graphics library I would:
Have a class to represent an 'growing circle' Have a vector/array to hold pointers to all the 'growing circles' I create.
All circles diameters would be increased each tick, and in my renderloop I would iterate the list and draw appropriate circles to my buffer.
This, however, doesn't seem to fit well with how I've generally used views in previous iPhone development.
So I guess it's kind of open-ended, but is there a 'correct' way for something like this?
Would it be in a game loop style (as described above), or should I be subclassing UIView
for a 'circle' object, and override drawRect
? I guess I would then have to add each circle by creating a view and adding it to my main view?
Initial investigation also brought me across references to the CAShapeLayer class, though I'm guessing this might be much the same as implementing the UIView subclassing technique.