Skip navigation.
 
mlRe: UI elements in custom view mess up drawing
FROM : Graham Cox
DATE : Tue Oct 14 15:44:17 2008

On 15 Oct 2008, at 12:38 am, Antonio Nunes wrote:

> As you can see from the image it looks like the view first draws 
> itself correctly, then gets drawn for each of the other subviews, 
> with its origin offset to match the origin of the subview in 
> question. I don't understand why this happens.


You've made the classic error of assuming that 'rect' passed to 
drawRect: is your view's bounds. It's not. It's the area requiring 
update.

Replace all references to 'rect' with [self bounds] and all will be 
well. This must crop up at least once or twice a month.

hth,


Graham

Related mailsAuthorDate
mlUI elements in custom view mess up drawing Antonio Nunes Oct 14, 15:38
mlRe: UI elements in custom view mess up drawing Benjamin Stiglitz Oct 14, 15:43
mlRe: UI elements in custom view mess up drawing Graham Cox Oct 14, 15:44
mlRe: UI elements in custom view mess up drawing Antonio Nunes Oct 14, 16:16