• 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: CALayers Lost After Switching Window's ContentView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALayers Lost After Switching Window's ContentView


  • Subject: Re: CALayers Lost After Switching Window's ContentView
  • From: David Duncan <email@hidden>
  • Date: Mon, 16 Feb 2009 12:45:22 -0800

You probably spoke with me, so I'll go ahead and fill in the details :).

On Feb 16, 2009, at 11:50 AM, E. Wing wrote:

If memory serves, the problem was that AppKit was too aggressive about
freeing the layer-backing of the NSViews it owns. My application was a
mixure of both NSViews and CALayers. I think I was told that Apple didn't
like me mixing the two to the aggressive degree I was doing.

AppKit will basically release layers that it owns when the associated view is not onscreen. Things like hiding a toolbar, switching the view in a tab view, or removing a view from a window will all cause the layer to be released. This is neither an exhaustive list, nor something that you should rely upon in your application.


I was told that for every NSView I used, I should subclass setLayer which
gives you a chance to intervene in the setup/tear down process. But I forgot
most of the details.

The simplest solution, if you can mange it, is to set the view's layer to your own layer, at which point AppKit will take a hands off approach and allow you to determine when the layer should go away.


The alternative, which is primarily for use if you need AppKit to continue to draw to the view's layer, is to override -setLayer: to do any required setup for your layer tree. So what you would do is check if the incoming layer is non-nil, and if it is, make any changes to that layer (including adding sublayers) at that point.

--
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


  • Follow-Ups:
    • Re: CALayers Lost After Switching Window's ContentView
      • From: Timothy Wood <email@hidden>
References: 
 >CALayers Lost After Switching Window's ContentView (From: Bridger Maxwell <email@hidden>)
 >Re: CALayers Lost After Switching Window's ContentView (From: "E. Wing" <email@hidden>)

  • Prev by Date: Re: Official keycode table?
  • Next by Date: Re: Using NSRulerView with a non-text view
  • Previous by thread: Re: CALayers Lost After Switching Window's ContentView
  • Next by thread: Re: CALayers Lost After Switching Window's ContentView
  • Index(es):
    • Date
    • Thread