• 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: wits end with nsview and nsrectfill()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wits end with nsview and nsrectfill()


  • Subject: Re: wits end with nsview and nsrectfill()
  • From: Kyle Sluder <email@hidden>
  • Date: Sun, 30 Nov 2014 09:54:00 -0800

On Nov 30, 2014, at 9:30 AM, Navneet Kumar <email@hidden> wrote:
>
> Hi,
>
> I have a custom view in which I am setting the background using NSRectFill() in drawRect:.

You’re aware that this function is only really suitable for drawing opaque colors, yes? If you NSRectFill() with a transparent color, it will not blend that color with the existing backing store. Instead, it will replace all pixels in that rect with transparent ones, obliterating any drawing performed by ancestor views in the hierarchy.

> I am also adding a text field as subview in this method.

This is not allowed. -drawRect: is for drawing, not mutating your view hierarchy.

If you want to position/install views at the last possible second before the drawing pass, use -viewWillDraw. But you have not offered any reasons why you need to dynamically add or remove views at all, much less in tandem with the drawing pass.

--Kyle Sluder
_______________________________________________

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: wits end with nsview and nsrectfill()
      • From: Navneet Kumar <email@hidden>
References: 
 >wits end with nsview and nsrectfill() (From: Navneet Kumar <email@hidden>)

  • Prev by Date: Re: wits end with nsview and nsrectfill()
  • Next by Date: Predicate Row Template array within array
  • Previous by thread: Re: wits end with nsview and nsrectfill()
  • Next by thread: Re: wits end with nsview and nsrectfill()
  • Index(es):
    • Date
    • Thread