• 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: Jonathan Dann <email@hidden>
  • Date: Tue, 10 Jun 2008 19:02:28 +0100


On 10 Jun 2008, at 17: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.


On 10 Jun 2008, at 17:03, Andy Lee wrote:
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

Thanks to you both, you're absolutely correct! Works like a charm now.

I'd like to be able to change the fill of my view depending on whether the application is active or not. The only problem is -drawRect isn't called when the application becomes inactive, is there a notification I can register for? In all my NSControl subclassing -drawRect is called on both become active and deactivating.

Thanks again for your help, that subtlety has never come to light until now.

Jonathan

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

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: crash on command-W
  • Next by Date: Tooltip and 10.4.11. Bug?
  • Previous by thread: Re: NSSlider responding to superview's drawRect
  • Next by thread: Re: NSSlider responding to superview's drawRect
  • Index(es):
    • Date
    • Thread