• 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: Standard controls on top of NSGradients
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Standard controls on top of NSGradients


  • Subject: Re: Standard controls on top of NSGradients
  • From: Charles Burnstagger <email@hidden>
  • Date: Mon, 5 Apr 2010 12:54:10 -0700 (PDT)

Thanks.

Changing to [ self.theGradient drawInRect:self.bounds angle:90.0 ];

in drawRect:

did the trick.

Chuck




________________________________
From: David Duncan <email@hidden>
To: Charles Burnstagger <email@hidden>
Cc: email@hidden
Sent: Mon, April 5, 2010 12:23:46 PM
Subject: Re: Standard controls on top of NSGradients

On Apr 5, 2010, at 12:15 PM, Charles Burnstagger wrote:

> When I place standard controls on top of one of my custom gradient views, when clicked, they also draw their rects with the same gradient - even though I don't include any code to do that. Do I need to lockFocus or some other aspect of CG on my custom view before I draw my gradient in my view's drawRect: method?


What happens is when those controls redraw, some part of your view is invalidated, so you are asked to draw again. I suspect that when you draw, you are then using the rect parameter passed to -drawRect: to determine the extends of the gradient – which is incorrect.

The rect parameter passed to -drawRect: is only a hint as to what parts of the view need to be redrawn. You should always do your drawing with respect to your view's bounds.
--
David Duncan
Apple DTS Animation and Printing



_______________________________________________

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: 
 >Standard controls on top of NSGradients (From: Charles Burnstagger <email@hidden>)
 >Re: Standard controls on top of NSGradients (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Problem with NSData
  • Next by Date: Re: Bindings & ivars
  • Previous by thread: Re: Standard controls on top of NSGradients
  • Next by thread: UpdateSystemActivity replacement in Cocoa?
  • Index(es):
    • Date
    • Thread