Skip navigation.
 
mlRe: UI elements in custom view mess up drawing
FROM : Benjamin Stiglitz
DATE : Tue Oct 14 15:43:45 2008

> When I turn off the progress indicator
> however, or when I update the string value of the text field, the drawing
> from the drawRect method above is drawn offset from its origin, instead
> drawing at the origin of either of the subviews, resulting in spurious
> lines being drawn where there should only be background (the gradient).
> (You can see a screenshot of the effect here:
> http://sintraworks.com/private/RenderingMess.png)


The rect passed to -[NSView drawRect:] is the dirty rect of the view,
not the bounds of the view. The changing subviews are dirtying your view
and then you're drawing as if that changed area was your complete frame.

Try replacing your use of rect with -[NSView bounds] instead, and then
take a look at the View Programming Guide [1].

-Ben

[1]: <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/chapter_1_section_1.html>

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