Thanks for the tip Ken.  It had forgot about the automatically-created 
contentView, and that was indeed the source of my problem.  Besides setting up 
animation for the contentView, I also had to switch to calling replaceSubview 
on the contentView instead of directly on the NSBox. 

Thanks again.

On Feb 2, 2010, at 2:56 PM, Mark Sanvitale wrote:

> Hi Mark,
> 
> You probably want to set the animations on the box's contentView in addition 
> to the box itself.
> 
> Box forwards modifications to its subviews array to its contentView.  
> However, this is something we'd like to get rid of eventually.  It's just a 
> question of doing it compatibly, having time to evaluate the impact on apps, 
> etc.
> 
> -Ken
> Cocoa Frameworks
> 
> On Tue, Feb 2, 2010 at 10:56 PM, Mark Sanvitale <[email protected]> wrote:
> "Breaks" is a subjective description (thus the quotes) for what I 
> experienced, but from my perspective it is accurate.  Here's what happened.  
> I had a custom subclass of NSView and I setup it up (in code) to be 
> layer-backed with a CATransition for the "subviews" key (i.e. fade in/out 
> animation for changes to the subviews).  All is well.
> 
> Changed this custom subclass to descend from NSBox (instead of NSView) so I 
> could take advantage of the selection-highlighting-within-a-Collection-View 
> trick demonstrated in the "IconCollection" (Apple-provided) sample project 
> (take an NSBox with a fill color and bind its transparent property to the 
> "selected" property of its associated NSCollectionViewItem).
> 
> A day or so later I notice that my fade in/out animation is gone.  Eventually 
> track this regression down to the change from NSView-subclass to 
> NSBox-subclass.
> 
> Should I be surprised by this difference in behavior between NSView and 
> NSBox?  I have been setting up my animation via:
> 
>        [self setWantsLayer:YES];
>        [self setAnimations:[NSDictionary dictionaryWithObject:transition 
> forKey:@"subviews"]];
> 
> and then expecting animation to occur when executing this:
> 
>        [[self animator] replaceSubview:mThumbnailStandin with:mThumbnail];
> 
> perhaps there is some other way to install/provide my animation that NSBox 
> will respect?
> 
> Any ideas?  I realize there is the straightforward approach of staying with 
> an NSView sub-class and doing my own binding-friendly fill color.
> 
> Thanks in advance.
> 
> Mark Sanvitale
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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/kenferry%40gmail.com
> 
> This email sent to [email protected]
> 

_______________________________________________

Cocoa-dev mailing list ([email protected])

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