• 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: Appropriate -setWantsLayer: timing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appropriate -setWantsLayer: timing


  • Subject: Re: Appropriate -setWantsLayer: timing
  • From: Dave Keck <email@hidden>
  • Date: Wed, 17 Feb 2010 17:00:52 -1000

> That's actually a more distilled version of my question. When your layer hosting view may be instantiated programatically, or from a NIB; there is no good place that covers both since the -init methods are too early (I haven't needed to test -initWithCoder: yet).
>
> Nor have I determined the boundary condition for which it works afterwards, I suspect it's after the has been placed in the view hierarchy. But if that's the case, does the view hierarchy need to be rooted in a window or can it be floating.
>
> One simple workaround I've been using (but wanted to check for a better solution) is to call -setWantsLayer:YES in -initWithFrame: and layer-back the view's parent in the XIB.

My solution to this problem is as follows:

    1. Override -setWantsLayer: to simply [super setWantsLayer: YES]
    2. Call [self setWantsLayer: YES] in the custom view's -initWithFrame:.

To my knowledge this guarantees that the view will will always be set
up for layer-hosting, regardless of whether it's instantiated by the
NIB machinery or programatically. Furthermore it allows you to fully
set up the view in initWithFrame:, avoiding the spaghetti between
-initWithFrame: and -awakeFromNib.
_______________________________________________

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: 
 >Appropriate -setWantsLayer: timing (From: Keith Duncan <email@hidden>)
 >Re: Appropriate -setWantsLayer: timing (From: David Duncan <email@hidden>)
 >Re: Appropriate -setWantsLayer: timing (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: The 64 pixels width limit on Windows
  • Next by Date: Re: Appropriate -setWantsLayer: timing
  • Previous by thread: Re: Appropriate -setWantsLayer: timing
  • Next by thread: Re: Appropriate -setWantsLayer: timing
  • Index(es):
    • Date
    • Thread