Re: NSAnimatablePropertyContainer and delegate

Christiaan Hofman <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Dec 21, 2009, at 0:40, Adam R. Maxwell wrote:

> 
> On Dec 20, 2009, at 2:44 PM, Christiaan Hofman wrote:
> 
>> I need to use delegate methods for animations run through NSAnimatablePropertyContainer (-animator proxy) to know when the animation has finished. The main problem is CAAnimation's buggy behavior of retaining its delegate (I am aware it's as designed, but that only means it's a design bug).
>> 
>> So my basic question is: how am I supposed to use (set/unset) the delegate of an animation that's run behind the scene by the animator proxy?
>> 
>> Some observations.
>> 
>> To be able to set the delegate, I need to provide my own animation, probably through -setAnimations:, or otherwise by overriding -animationForKey:, because the default animation doesn't allow the delegate to be set for some reason (which I don't understand).
>> 
>> However, I can't just set the delegate for this custom animation, because that results in a retain cycle, and therefore a leak (that's why the behavior noted above is buggy). 
> 
> Could you set the delegate to an proxy object that the animation retains, but which doesn't retain your real delegate?  You could then use forwardingTargetForSelector: to forward messages.
> 

I guess that would be possible. But it seems rather complicate, it needs a whole custom class for each delegate I would have. That seems to be completely contrary to the whole delegate idea.

> I don't have a suggestion for any of your other questions; I've avoided using -animator as much as possible because of other bugs we've previously discussed.
> 


I'm also very disappointed by CA, it has some serious bugs and restrictions. In most of the cases I've needed animations NSAnimation still does a much better job.

thanks
Christiaan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.