views:

102

answers:

1

Currently, any time I manually move a UIImage (via handling the touchesMoved event) the last thing I call in that event is [self setNeedsDisplay], which effectively redraws the entire view.

My images are also being animated, so every time a frame of animation changes, i have to call setNeedsDisplay.

I find this to be horrific since I don't expect iphone/cocoa to be able to perform such frequent screen redraws very quickly.

Is there an optimal, more efficient way that I could be doing this? Perhaps somehow telling cocoa to update only a particular region of the screen (the rect region of the image)?

Thanks!

+3  A: 

setNeedsDisplayInRect: does exactly what you need.

See documentation at developer.apple.com

peterb