CATransition on NSSplitView replaceSubview
CATransition on NSSplitView replaceSubview
- Subject: CATransition on NSSplitView replaceSubview
- From: "email@hidden" <email@hidden>
- Date: Mon, 14 Jan 2008 00:22:17 +0000
Hello All.
In the absence of IB functionality on transitions I am trying to set
up a dissolve
when replacing an NSSPlitView subview.
The code below has been adapted from http://developer.apple.com/samplecode/CocoaSlides/
.
The subview is replaced but no animation occurs.
If I use IB to turn on layering for the view class it does work!
So must [self setWantsLayer:YES] be set elsewhere?
And does it have to be set on all the subviews too?
Thanks in advance
Jonathan
@interface MGSMotherWindowSplitview : NSSplitView {
}
- (void)updateSubviewsTransition;
- (void)replaceTopView:(NSView *)newView;
@end
#import "MGSMotherWindowSplitview.h"
#import <QuartzCore/CAAnimation.h>
#import <QuartzCore/CoreImage.h>
@implementation MGSMotherWindowSplitview
- initWithFrame:(NSRect)newFrame {
self = [super initWithFrame:newFrame];
if (self) {
[self setWantsLayer:YES];
[self updateSubviewsTransition];
}
return self;
}
- (void)updateSubviewsTransition {
CATransition *transition = [CATransition animation];
[transition setType:kCATransitionFade];
[transition setSubtype:kCATransitionFromLeft];
[transition setDuration:1.0];
[self setAnimations:[NSDictionary dictionaryWithObject:transition
forKey:@"subviews"]];
}
- (void)replaceTopView:(NSView *)newView
{
[[self animator] replaceSubview:[[self subviews] objectAtIndex:0]
with:newView];
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden