CoreAnimation - Resizing sublayers along with superlayer animation
CoreAnimation - Resizing sublayers along with superlayer animation
- Subject: CoreAnimation - Resizing sublayers along with superlayer animation
- From: Ignacio Enriquez <email@hidden>
- Date: Fri, 20 Aug 2010 17:24:52 +0900
Hi,
I have a subclass of CALayer (below self) and it has a sublayer (textLayer).
I want self to be shrank and enlarges, so I created animations like
the following:
CABasicAnimation *fadeInAnimation;
fadeInAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
fadeInAnimation.repeatCount = 1;
fadeInAnimation.autoreverses = NO;
fadeInAnimation.fromValue = [NSNumber numberWithFloat:1.0];
fadeInAnimation.toValue = [NSNumber numberWithFloat:0.0];
CABasicAnimation *shrinkAnimation;
shrinkAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size"];
shrinkAnimation.repeatCount = 1;
shrinkAnimation.autoreverses = NO;
shrinkAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseIn];
shrinkAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];
aniGroupOFF = [[CAAnimationGroup animation] retain];
aniGroupOFF.delegate = self;
aniGroupOFF.duration = ANI_DURATION;
aniGroupOFF.animations = [NSArray arrayWithObjects:shrinkAnimation,
fadeInAnimation, nil];
then I commit the animation
[self addAnimation:aniGroupOFF forKey:@"shrinkAndFadeOff"];
self is animated as expected but sublayer textLayer is not resized, it
just changes its position according to the new bounds of self
I would like to have the same effect when animation view, they resize
automatically their subviews and/or sublayers
Thanks in advance.
BTW: I tried also:
[self setNeedsDisplayOnBoundsChange:YES];
and overriding
-(void)layoutSublayers{[textLayer setFrame:accordingFrame];}
but didn't work ;(
Ignacio
_______________________________________________
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