Re: CATransition on NSSplitView replaceSubview
Re: CATransition on NSSplitView replaceSubview
- Subject: Re: CATransition on NSSplitView replaceSubview
- From: "email@hidden" <email@hidden>
- Date: Mon, 14 Jan 2008 15:12:02 +0000
Hello Scott
Thanks for the reply, and the hot find tip ;-)
I have not figured out why but the animation works if [self
setWantsLayer:YES] is moved
from the view - initWithFrame:newFrame and is called from the window
controller - windowDidLoad.
The receiver is just getting the message after the nib has loaded.
Which, of course, is what the CocoaSlides demo does.
Reading the core animation docs didn't hurt either!
Thanks again
Jonathan
On 14 Jan 2008, at 01:31, Scott Anguish wrote:
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