Re: CALayer's delegate prevents implicit animation?
On 18 Dec 2013, at 21:46, Sean McBride s...@rogue-research.com wrote: Wait, what? You're saying a CALayer's delegate can't be its parent NSView? Why? Where does it say that? I've been doing that for years without apparent problem. I'd be interested to hear more… It broke with 10.9 at the latest. From then on, NSView drawing code implements -drawLayer:inContext:, which breaks any use of the ‘content’ property of a CALayer whose delegate is a view. I don’t have any documentation, but the fact is it simply doesn’t work anymore in certain cases, which is an obvious sign Apple doesn’t expect you to do this. To be safe (not to mention avoid the obvious code smell of making a view a controller), use a separate object as the delegate. Cheers, -- Uli Kusterer “The Witnesses of TeachText are everywhere...” http://zathras.de ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer's delegate prevents implicit animation?
On 18 Dec 2013, at 20:46, Sean McBride s...@rogue-research.com wrote: Wait, what? You're saying a CALayer's delegate can't be its parent NSView? Why? Where does it say that? I've been doing that for years without apparent problem. I'd be interested to hear more… Layer-backed views operate by the view being delegate of its layer. Thus if you make a view the delegate of any other layers, it may well not be designed to handle that. It will likely assume all delegate messages are from its own layer — rather than another, arbitrary one — and mishandle them. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CALayer's delegate prevents implicit animation?
Short version: In 10.9 only: My CALayer's delegate doesn't implement **any** delegate methods, but because a delegate is set, the layer's position will not implicitly animate. If I don't set it, it works fine. Longer version: I have a view hosting a very plain root layer, and then this layer in question as a sublayer of that root layer. rootLayer = [[CALayer alloc] init]; self.layer = rootLayer; self.wantsLayer = YES; rootLayer.frame / bounds / delegate = ...; sublayer = [[CALayer alloc] init]; sublayer.frame / bounds = ...; sublayer.delegate = self; Later on I simply move it... [CATransaction begin]; [CATransaction setAnimationDuration:1.0]; [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; sublayer.position = newPosition; [CATransaction commit]; ... and it's not animating. I have narrowed it down to the delegate being non-nil, even if the delegate implements none of the delegate methods. If I don't set it, it works fine. This was working fine for yeeears and now in 10.9 it's behaving differently. What could possibly be happening? -- Seth Willits ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer's delegate prevents implicit animation?
What is the identify of your delegate? On Dec 18, 2013, at 10:51 AM, Seth Willits sli...@araelium.com wrote: Short version: In 10.9 only: My CALayer's delegate doesn't implement **any** delegate methods, but because a delegate is set, the layer's position will not implicitly animate. If I don't set it, it works fine. Longer version: I have a view hosting a very plain root layer, and then this layer in question as a sublayer of that root layer. rootLayer = [[CALayer alloc] init]; self.layer = rootLayer; self.wantsLayer = YES; rootLayer.frame / bounds / delegate = ...; sublayer = [[CALayer alloc] init]; sublayer.frame / bounds = ...; sublayer.delegate = self; Later on I simply move it... [CATransaction begin]; [CATransaction setAnimationDuration:1.0]; [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; sublayer.position = newPosition; [CATransaction commit]; ... and it's not animating. I have narrowed it down to the delegate being non-nil, even if the delegate implements none of the delegate methods. If I don't set it, it works fine. This was working fine for yeeears and now in 10.9 it's behaving differently. What could possibly be happening? -- Seth Willits ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com This email sent to david.dun...@apple.com -- David Duncan ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer's delegate prevents implicit animation?
Oooo… Yeah, it's an NSView which I imagine is the problem. Documenting this behavior would be very useful. My entire app is one view, with zillions of layers in it, so I have the view as the master coordinator for everything. Since it knows about various views and their layout relationships, I set it as the delegate for a few layers because of the access it already has to needed info. It's easy enough to work around this case though. -- Seth Willits On Dec 18, 2013, at 11:13 AM, David Duncan david.dun...@apple.com wrote: What is the identify of your delegate? On Dec 18, 2013, at 10:51 AM, Seth Willits sli...@araelium.com wrote: Short version: In 10.9 only: My CALayer's delegate doesn't implement **any** delegate methods, but because a delegate is set, the layer's position will not implicitly animate. If I don't set it, it works fine. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer's delegate prevents implicit animation?
Yah you can't make the parent view of the layer the delegate. Nasty things can happen. One of my interview questions I ask :) Please excuse mobile typos On Dec 18, 2013, at 11:50 AM, Seth Willits sli...@araelium.com wrote: Oooo… Yeah, it's an NSView which I imagine is the problem. Documenting this behavior would be very useful. My entire app is one view, with zillions of layers in it, so I have the view as the master coordinator for everything. Since it knows about various views and their layout relationships, I set it as the delegate for a few layers because of the access it already has to needed info. It's easy enough to work around this case though. -- Seth Willits On Dec 18, 2013, at 11:13 AM, David Duncan david.dun...@apple.com wrote: What is the identify of your delegate? On Dec 18, 2013, at 10:51 AM, Seth Willits sli...@araelium.com wrote: Short version: In 10.9 only: My CALayer's delegate doesn't implement **any** delegate methods, but because a delegate is set, the layer's position will not implicitly animate. If I don't set it, it works fine. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/cody%40servalsoft.com This email sent to c...@servalsoft.com ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer's delegate prevents implicit animation?
Wait, what? You're saying a CALayer's delegate can't be its parent NSView? Why? Where does it say that? I've been doing that for years without apparent problem. I'd be interested to hear more... Sean On Wed, 18 Dec 2013 12:39:12 -0800, Cody Garvin said: Yah you can't make the parent view of the layer the delegate. Nasty things can happen. One of my interview questions I ask :) Please excuse mobile typos On Dec 18, 2013, at 11:50 AM, Seth Willits sli...@araelium.com wrote: Oooo… Yeah, it's an NSView which I imagine is the problem. Documenting this behavior would be very useful. My entire app is one view, with zillions of layers in it, so I have the view as the master coordinator for everything. Since it knows about various views and their layout relationships, I set it as the delegate for a few layers because of the access it already has to needed info. It's easy enough to work around this case though. -- Seth Willits On Dec 18, 2013, at 11:13 AM, David Duncan david.dun...@apple.com wrote: What is the identify of your delegate? On Dec 18, 2013, at 10:51 AM, Seth Willits sli...@araelium.com wrote: Short version: In 10.9 only: My CALayer's delegate doesn't implement **any** delegate methods, but because a delegate is set, the layer's position will not implicitly animate. If I don't set it, it works fine. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com