How do I stop setNeedsDisplayInRect / drawRect coalescence?

Posted by No One in Particular on Stack Overflow See other posts from Stack Overflow or by No One in Particular
Published on 2010-05-29T14:46:05Z Indexed on 2010/05/29 14:52 UTC
Read the original article Hit count: 172

Filed under:

When programming my app, I get to the point where I have to update two rectangles on the screen. So I call [self setNeedsDisplayInRect:rect1] and then [self setNeedsDisplayInRect:rect2]. When my drawRect method is called, the rectangle parameter is the smallest rectangle which contains both rect1 and rect2.

I can handle this with no problem, but when the two rectangles are far apart, then I am updating a lot of real estate with no gain. In this case, I would just like to repaint my two small rectangles.

So my question is how can I prevent the underlying system from coalescing my two calls into one?

© Stack Overflow or respective owner

Related posts about iphone