Skip navigation.
 
mlRe: NSSlider responding to superview's drawRect
FROM : Andy Lee
DATE : Tue Jun 10 18:03:51 2008

Check the code that draws the 1-pixel line.  It should be calculating 
coordinates of the line based on the view's bounds rectangle, not the 
rectangle that is passed to drawRect:.

--Andy

On Jun 10, 2008, at 11:51 AM, Jonathan Dann wrote:

> Hi All,
>
> This is something that I haven't seen before. I have a custom view 
> that inherits from NSView directly and just draws a gradient 
> background. In IB I've placed an NSSlider on the view which works 
> fine. The problem comes when drawRect in my custom view is invoked, 
> I draw the gradient and a 1px line at the top of the view, but the 
> line also gets draw just above the NSSlider! logging shows the 
> following
>
> 1) resize window - drawRect is called and the line above the slider 
> disappears
> 2) move slider - drawRect is called from my gradient view but with 
> the frame of the slider. The line then appears.
>
> Is this a known issue with NSSlider and a custom view or have I 
> missed an idiosyncracy of NSControls.
>
> Thanks in adavnce,
>
> Jonathan

Related mailsAuthorDate
mlNSSlider responding to superview's drawRect Jonathan Dann Jun 10, 17:51
mlRe: NSSlider responding to superview's drawRect Andy Lee Jun 10, 18:03
mlRe: NSSlider responding to superview's drawRect Ken Ferry Jun 10, 18:05
mlRe: NSSlider responding to superview's drawRect Jonathan Dann Jun 10, 20:02
mlRe: NSSlider responding to superview's drawRect Michael Watson Jun 10, 23:22
mlRe: NSSlider responding to superview's drawRect Graham Cox Jun 11, 01:18