setneedsdisplayinrect

setNeedsDisplayInRect called during drawLayer:inContext:

青春壹個敷衍的年華 提交于 2019-12-23 10:08:58
问题 I use a CATiledLayer in my app, and as a result, drawing of that layer is done in a background thread. That is, the drawLayer:inContext: method of my delegate is called from a background thread. The setNeedsDisplayInRect used to invalidate parts of the CATiledLayer is always called from the main thread. Because they are independent threads, it occasionally happens that the setNeedsDisplayInRect is called while the background thread is in the drawLayer:inContext method. I have noticed that the

setNeedsDisplayInRect bug in iOS5?

一世执手 提交于 2019-12-18 05:22:32
问题 I'm trying to use setNeedsDisplayInRect: in iOS5 to optimize some drawing code. The setup is simple: I have an array of CGRect 'hotspots' that function as buttons. When a touch is detected I find the CGRect it occurred in and call setNeedsDisplayInRect: on the view with that rect as a param. All the CGRects are valid for the view - it uses them to do it's initial drawing and that comes out correctly. What I am seeing (as the Console dump below shows) is that the first call to