I have a window which contains an NSBox control. In that NSBox are several other controls, (popups, text fields, etc...)
I have two other NSBox's in the same NIB file that are filled with controls that I would like to swap out with the first under certain conditions. I would like this to happen with a nice cross fade effect, so I do the following:
In the NSWindowController's -awakeFromNib
method:
[[self.myWindow contentView] setWantsLayer:YES];
In my method where I'm switching the views I use this code:
[[[self.myWindow contentView] animator] replaceSubview:previousView with:newView];
This works just fine, the views cross fade just as I would expect. The problem is that the controls on the views sometimes disappear for no apparent reason. It's not always the same views (though the NSPopUpButtons seem particularly prone to it), and they usually reappear when they have focus.
Do I have to make all of the controls layer backed as well?
Update: Wrapping the animation in explicit grouping did not make any difference. Turning on setWantsLayer in the Nib file also didn't make a difference, but what is interesting is that when I did so, the NSPopupbuttons vanish until their containing view is clicked on. Setting Layer's manually on the NSPopupbuttons didn't make a difference either.
It appears that others have had this problem, but I can't find any solutions posted:
http://www.cocoabuilder.com/archive/message/cocoa/2008/3/30/202691 http://www.cocoabuilder.com/archive/message/cocoa/2008/4/25/205134