Re: CALayer-hosting view and child NSView's
A layer-hosting view can’t have subviews, which is what it sounds like you want to do in the second to last paragraph. Why can’t you just use layer-backed views? You get the controls, you can still do animation using the animation proxy and the other animation methods. On Jun 30, 2010, at 5:27 AM, Oleg Krupnov wrote: Hi, I'd like to create a custom view based on Core Animation, namely, a layer-hosting view. In other words, I'd like to directly manipulate layers in my code rather than using children NSView's. The custom view is like a matrix consisting of cells. Each cell is represented with a separate CALayer. However, certain cells should contain standard buttons like if they were child views of those cell layers. In other words, when I move the cell layer, the button needs to move synchronously; when I hide the cell layer, the button needs to hide as well. I would like to use the standard NSButton control, to avoid reinventing the wheel. But if I just place the button as a first-level child view of the custom view, it will not be associated with its parent cell layer. I also cannot access and manipulate NSButton's root layer to add it as a sublayer to the cell layer, AFAIK. So what is the best way around? ___ 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 arch...@mail-archive.com
Re: CALayer-hosting view and child NSView's
Right, I want to add subviews into a layer-hosting view. I want to do this, in particular, because I want the cells in my custom view to drop shadows. If I implement cells like simple subviews and use layer-backed view, I can't seem to do it, can I? I have performed an experiment right now and it seems that it's okay to add subviews to a layer-hosting view. It seems to work fine. Is there any explicit prohibition to do so in the docs? Thanks. On Thu, Jul 1, 2010 at 10:07 AM, Scott Anguish sc...@cocoadoc.com wrote: A layer-hosting view can’t have subviews, which is what it sounds like you want to do in the second to last paragraph. Why can’t you just use layer-backed views? You get the controls, you can still do animation using the animation proxy and the other animation methods. On Jun 30, 2010, at 5:27 AM, Oleg Krupnov wrote: Hi, I'd like to create a custom view based on Core Animation, namely, a layer-hosting view. In other words, I'd like to directly manipulate layers in my code rather than using children NSView's. The custom view is like a matrix consisting of cells. Each cell is represented with a separate CALayer. However, certain cells should contain standard buttons like if they were child views of those cell layers. In other words, when I move the cell layer, the button needs to move synchronously; when I hide the cell layer, the button needs to hide as well. I would like to use the standard NSButton control, to avoid reinventing the wheel. But if I just place the button as a first-level child view of the custom view, it will not be associated with its parent cell layer. I also cannot access and manipulate NSButton's root layer to add it as a sublayer to the cell layer, AFAIK. So what is the best way around? ___ 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 arch...@mail-archive.com
Re: CALayer-hosting view and child NSView's
On Jul 1, 2010, at 3:14 AM, Oleg Krupnov wrote: Right, I want to add subviews into a layer-hosting view. You can’t. I want to do this, in particular, because I want the cells in my custom view to drop shadows. If I implement cells like simple subviews and use layer-backed view, I can't seem to do it, can I? Why can’t your cell drawing class (assuming they’re custom classes) just draw the shadow? And shadows for buttons aren’t exactly a common user experience. I have performed an experiment right now and it seems that it's okay to add subviews to a layer-hosting view. It seems to work fine. Is there any explicit prohibition to do so in the docs? Yes. Animation Overview. It could be stronger, and I’ll repeat it elsewhere. Regardless, don’t do it. Thanks. On Thu, Jul 1, 2010 at 10:07 AM, Scott Anguish sc...@cocoadoc.com wrote: A layer-hosting view can’t have subviews, which is what it sounds like you want to do in the second to last paragraph. Why can’t you just use layer-backed views? You get the controls, you can still do animation using the animation proxy and the other animation methods. On Jun 30, 2010, at 5:27 AM, Oleg Krupnov wrote: Hi, I'd like to create a custom view based on Core Animation, namely, a layer-hosting view. In other words, I'd like to directly manipulate layers in my code rather than using children NSView's. The custom view is like a matrix consisting of cells. Each cell is represented with a separate CALayer. However, certain cells should contain standard buttons like if they were child views of those cell layers. In other words, when I move the cell layer, the button needs to move synchronously; when I hide the cell layer, the button needs to hide as well. I would like to use the standard NSButton control, to avoid reinventing the wheel. But if I just place the button as a first-level child view of the custom view, it will not be associated with its parent cell layer. I also cannot access and manipulate NSButton's root layer to add it as a sublayer to the cell layer, AFAIK. So what is the best way around? ___ 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 arch...@mail-archive.com
Re: CALayer-hosting view and child NSView's
Thanks Scott, To draw shadows around cells, I would have to draw outside the cell view's frame, i.e. on the parent view or sibling cells, respecting the z-order. Is this possible? Also, the cells in my view can be moving over each other with an animation. When the cell view is moved using setFrame, it does not receive the drawRect:, neither do the parent view and the sibling cell views. so there seems no chance to update its shadow (even assuming it's possible to draw outside the cell view) Thanks! On Thu, Jul 1, 2010 at 10:42 AM, Scott Anguish sc...@cocoadoc.com wrote: On Jul 1, 2010, at 3:14 AM, Oleg Krupnov wrote: Right, I want to add subviews into a layer-hosting view. You can’t. I want to do this, in particular, because I want the cells in my custom view to drop shadows. If I implement cells like simple subviews and use layer-backed view, I can't seem to do it, can I? Why can’t your cell drawing class (assuming they’re custom classes) just draw the shadow? And shadows for buttons aren’t exactly a common user experience. I have performed an experiment right now and it seems that it's okay to add subviews to a layer-hosting view. It seems to work fine. Is there any explicit prohibition to do so in the docs? Yes. Animation Overview. It could be stronger, and I’ll repeat it elsewhere. Regardless, don’t do it. Thanks. On Thu, Jul 1, 2010 at 10:07 AM, Scott Anguish sc...@cocoadoc.com wrote: A layer-hosting view can’t have subviews, which is what it sounds like you want to do in the second to last paragraph. Why can’t you just use layer-backed views? You get the controls, you can still do animation using the animation proxy and the other animation methods. On Jun 30, 2010, at 5:27 AM, Oleg Krupnov wrote: Hi, I'd like to create a custom view based on Core Animation, namely, a layer-hosting view. In other words, I'd like to directly manipulate layers in my code rather than using children NSView's. The custom view is like a matrix consisting of cells. Each cell is represented with a separate CALayer. However, certain cells should contain standard buttons like if they were child views of those cell layers. In other words, when I move the cell layer, the button needs to move synchronously; when I hide the cell layer, the button needs to hide as well. I would like to use the standard NSButton control, to avoid reinventing the wheel. But if I just place the button as a first-level child view of the custom view, it will not be associated with its parent cell layer. I also cannot access and manipulate NSButton's root layer to add it as a sublayer to the cell layer, AFAIK. So what is the best way around? ___ 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 arch...@mail-archive.com
Re: CALayer-hosting view and child NSView's
On Jul 1, 2010, at 12:56 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Thanks Scott, To draw shadows around cells, I would have to draw outside the cell view's frame, i.e. on the parent view or sibling cells, respecting the z-order. Is this possible? Again, layer-hosting views can't have subviews. You will need to implement your buttons as layers, at which point you can give them drop shadows quite easily. --Kyle Sluder___ 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 arch...@mail-archive.com
CALayer-hosting view and child NSView's
Hi, I'd like to create a custom view based on Core Animation, namely, a layer-hosting view. In other words, I'd like to directly manipulate layers in my code rather than using children NSView's. The custom view is like a matrix consisting of cells. Each cell is represented with a separate CALayer. However, certain cells should contain standard buttons like if they were child views of those cell layers. In other words, when I move the cell layer, the button needs to move synchronously; when I hide the cell layer, the button needs to hide as well. I would like to use the standard NSButton control, to avoid reinventing the wheel. But if I just place the button as a first-level child view of the custom view, it will not be associated with its parent cell layer. I also cannot access and manipulate NSButton's root layer to add it as a sublayer to the cell layer, AFAIK. So what is the best way around? Thanks! Oleg. ___ 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 arch...@mail-archive.com