Understanding layer-backed views
Understanding layer-backed views
- Subject: Understanding layer-backed views
- From: Graham Cox <email@hidden>
- Date: Wed, 22 Jun 2011 11:57:52 +1000
I'm getting confused and frustrated by Core Animation layers (again). Mac OS.
If I simply add a NSView to a window in IB, not subclassed, but turn on Core Animation layer for that view and set a background colour, shouldn't it appear with that colour in the window? That's my expectation, but that's not what I get. Instead, I see nothing. I can log the fact that the layer exists, and it has apparently the right dimensions and so on, but nothing is actually displayed.
Where are my assumptions faulty?
Further to this, when I add sublayers to this backing layer (or a root layer I create, as an alternative), I give them a frame property based on the view's bounds. They do display, but in the wrong place, not aligned with the view, but with the window. Again this is not in line with my expectations, which is that the frame of a sublayer is expressed in the coordinate system of its superlayer, not the underlying window.
I've been beating my head against this for a few hours now, and it's just not making sense.
--Graham'
_______________________________________________
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