(first time actually asking a question here, so forgive my etiquette blunders)
Basic situation . I have several images that can move around the screen.
Simple solution # 1 :
The main loop will step over the array of objects, say that each of them will move itself, and then say that the view is updated [self.view setNeedsDisplay]. Then the view will receive an array and step over it and draw objects at their point on the screen.
A very simple sample project that puts 200 arrows in NSArray and moves them around here .
Simple Solution # 2 :
Then I started experimenting with the fact that objects have their own appearance as a property.
When objects were added to the main NSArray, views were added to the main drawing view. [self.view addSubView:newThing.view].
The main loop will step over objects and make them move. Within an object class, moving will cause the view.origin frame to move, which will cause them to move in the main view.
This also has the advantage that objects can optionally add subobjects to their image, such as particle effects or related objects.
The disadvantage is that it seems to put more visible code in the model and hide some of the look-alike efforts.
.
. , , , .
?
№ 2 , , , , , , , , . 400 , .
- , № 2, ? "" VMC , , ?