• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CATransition on NSSplitView replaceSubview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CATransition on NSSplitView replaceSubview
      • From: Scott Anguish <email@hidden>
  • Prev by Date: [RESOLVED] Re: Curious about copyWithZone message from NSArrayController in "GC required" project
  • Next by Date: [RESOLVED] Re: Pattern colors and alpha
  • Previous by thread: [RESOLVED] Re: Pattern colors and alpha
  • Next by thread: Re: CATransition on NSSplitView replaceSubview
  • Index(es):
    • Date
    • Thread