• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSlider responding to superview's drawRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSlider responding to superview's drawRect


  • Subject: Re: NSSlider responding to superview's drawRect
  • From: Michael Watson <email@hidden>
  • Date: Tue, 10 Jun 2008 17:22:48 -0400

This is normally what I have to do as well, but is there a more optimized way to achieve the goal of drawing only the rect that needs redrawing?


-- m-s

On 10 Jun, 2008, at 12:05, Ken Ferry wrote:

You're probably filling your gradient into the rect passed in drawRect.

That rectangle just represents the dirty part of your view. If you had a solid color to draw, you could just fill the rect, but with a gradient you will get your gradient, top to bottom, within this possibly small rect within your view.

Try drawing the gradient into [self bounds] instead. This describes the location of the entire view in its own coordinate system.

-Ken

On Jun 10, 2008, at 8:51 AM, Jonathan Dann <email@hidden> 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
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
@bungie.org


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSSlider responding to superview's drawRect
      • From: Graham Cox <email@hidden>
References: 
 >NSSlider responding to superview's drawRect (From: Jonathan Dann <email@hidden>)
 >Re: NSSlider responding to superview's drawRect (From: Ken Ferry <email@hidden>)

  • Prev by Date: Re: Mail Rule Actions Control
  • Next by Date: Re: re-factoring a category into a class instance
  • Previous by thread: Re: NSSlider responding to superview's drawRect
  • Next by thread: Re: NSSlider responding to superview's drawRect
  • Index(es):
    • Date
    • Thread