user156144
user156144

Reputation: 2295

UIView with many circles

I am creating an iphone app and i am having some issues with drawing too many filled circles in UIVIew. My goal is to create a paint app and when the screen is touched, it should draw a filled circle in that area. I have a class derived from UIView that has 2 methods AddCircle which accepts Point and add it to a list. overriden Draw method that go through the list and draw circles.

When there are more than say 300 circles, my ios simulator can't draw circle as quickly as it used to.

I initially tried drawing a new circle in Draw but that erased everything that was drawn before the call. I would like to use the same view to draw many circles (or is it better to create a new View each time the screen is touched? It seems like it will create many many views...)

Any help would be great. Thanks!

Upvotes: 1

Views: 148

Answers (1)

Ben Baron
Ben Baron

Reputation: 14815

You're going about it the wrong way. For a paint app you should consider using a CGBitmapContext to draw into and display the contents of the bitmap context into a UIImageView. That way you are actually painting pixels.

That's assuming you aren't trying to make a vector art app instead.

Upvotes: 1

Related Questions