• 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: Layer-hosting views as superview?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Layer-hosting views as superview?


  • Subject: Re: Layer-hosting views as superview?
  • From: Matt Jacobson <email@hidden>
  • Date: Wed, 21 Mar 2018 10:40:22 -0700


> On Mar 21, 2018, at 6:36 AM, Markus Spoettl <email@hidden> wrote:
>
> On 3/21/18 14:26, Markus Spoettl wrote:
>> It seems the old rule that layer-hosting views must not have sub-views is no
>> longer
>> valid. I remember in the old days you couldn't have layer-hosting NSViews
>> that have
>> sub-views. I can't find the portion in the documentation that explicitly
>> forbids it
>> (I'm sure it was there).
>> Can that be right?
>
> As usual shortly after sending the message I finally find something. In the
> docs for -wantsLayer it says:
>
> ... Similarly, do not add subviews to a layer-hosting view.  ...
>
> BUT I also found a statement on stackoverflow by Corbin Dunn saying that it
> is OK
>
> https://stackoverflow.com/questions/10719368/are-layer-hosting-nsviews-allowed-to-have-subviews?rq=1
>
> So it seems OK since 10.8 Mountain Lion. Or not.

Hi Markus,

There's really no official distinction these days between a layer-hosting view
and a regular view.  A view may have a layer (provided by directly calling
-setLayer:), or AppKit may (or may not, depending on the exact circumstances)
give it a layer automatically.

Either way, the view is subject to the same rules about what properties of that
layer it may mutate (vs. those AppKit "owns")—see
<https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKit/#10_13Layer-backed Views

<https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKit/#10_13Layer-backed
 Views>>.

And either way, the view may certainly have subviews.  We'll update the
incorrect documentation—thanks for pointing that out.

Hope that helps,

Matt
_______________________________________________

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: Layer-hosting views as superview?
      • From: Markus Spoettl <email@hidden>
References: 
 >Layer-hosting views as superview? (From: Markus Spoettl <email@hidden>)
 >Re: Layer-hosting views as superview? (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: Creating object graph in swift, Core Data or vanilla objects?
  • Next by Date: Re: Layer-hosting views as superview?
  • Previous by thread: Re: Layer-hosting views as superview?
  • Next by thread: Re: Layer-hosting views as superview?
  • Index(es):
    • Date
    • Thread