Re: CATransition on NSSplitView replaceSubview
Re: CATransition on NSSplitView replaceSubview
- Subject: Re: CATransition on NSSplitView replaceSubview
- From: Scott Anguish <email@hidden>
- Date: Sun, 13 Jan 2008 20:31:07 -0500
transitions only work if the view is layer backed.
So you have to turn it on. turning it on for a view enables it for all
the descending views, so no.
As to where it is turned on in CocoaSlides, try the find command in
Xcode. :-)
SlideshowWindowControllerlm.m
On Jan 13, 2008, at 7:22 PM, email@hidden wrote:
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
_______________________________________________
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