On Nov 24, 2008, at 1:54 AM, Kenneth Ballenegger wrote:

I cannot find anything in the docs regarding this.
Is it possible, and if so, how, to set a layer's content to a view?

You might try setting up a delegate that calls the view's -drawRect: method, but this may not work in all cases. This is probably not trivial, which is why Appkit provides layers itself that know how to handle these details.

Now if you just want to replicate view contents, then you can set the contents of any layer to those of another layer.

The doc for the content propriety says it should be a CGImageRef, and the delegate methods seem to be for drawing content like one would draw in a view.

The contents property is typically a CGImageRef when dealing with user- generated content. It can also be the contents of another layer, allowing for content replication across layers.

Also, can it cause any problems having a whacky hierarchy of a main view containing layers, one of them containing another view with subviews which also have layers?


You may see strange things as AppKit manages its layer hierarchy, especially if some of those views go offscreen or are removed from the window. You might want to reconsider your design.
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to