Skip navigation.
 
mlRe: CoreAnimation weird problems with NSView animator
FROM : Troy Stephens
DATE : Thu Mar 27 22:03:00 2008

On Mar 26, 2008, at 9:12 AM, Milen Dzhumerov wrote:
> Hi all,
>
> I've been playing with CA today and encountered some weird problems. 
> Firstly, I tested setHidden: on an animator on a NSSegmentedView and 
> it worked fine - it gets faded in/out. Now, all the problems I 
> encountered happen in another NIB file. I've got the following piece 
> of code (in a controller):
>
> [self.generalView setHidden:YES];
> [self.window setContentView:self.generalView];
> [[self.generalView animator] setHidden:NO];


This should produce a fade transition, as long as self.generalView's 
superview, or an ancestor view higher up, has wantsLayer == YES.

Does it help if you wrap the un-hide in an explicit NSAnimationContext 
begin/end?

    [NSAnimationContext beginGrouping];
    [[self.generalView animator] setHidden:NO];
    [NSAnimationContext endGrouping];

> I expect this to animate the view but it doesn't happen - no 
> animation goes on. I've made sure that all NSView's want layers. I 
> also noticed some other unusual problems
> with the said NIB:
> - Animations work on a random basis (CA animations)


A more specific example would help.

> - If I attach an outlet to a particular NSPopUpButton, it 
> disappears. Removing the outlet makes it appear again


The NSPopUpButton disappears?  What do you see when you look at the 
popup button's state when this has happened?  (i.e. What does -
isHiddenOrHasHiddenAncestor report, and frame, superview, etc.?) 
Something must be collapsing it, hiding it, removing it from the view 
tree, or moving it out of its superview's visibleRect.

> I think I'm missing some setup here but I cannot figure out exactly 
> what it is. The NIB (saved as a XIB) was created from scratch (i.e., 
> not included in a project template) but I can't see how this can be 
> a problem. Any help is greatly appreciated.
>
> M



--
Troy Stephens
Cocoa Frameworks
Apple, Inc.

Related mailsAuthorDate
mlCoreAnimation weird problems with NSView animator Milen Dzhumerov Mar 26, 17:12
mlRe: CoreAnimation weird problems with NSView animator Troy Stephens Mar 27, 22:03
mlRe: CoreAnimation weird problems with NSView animator Milen Dzhumerov Mar 28, 17:07