I am attempting to scale my UIView at the same time as I fade in a shadow, using the following:
myController.view.layer.shadowOffset = CGSizeMake(0, 3);
myController.view.layer.shadowColor = [UIColor blackColor].CGColor;
myController.view.layer.shadowOpacity = 0.0;
myController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:myController.view.bounds].CGPath;
[UIView animateWithDuration:0.3
animations:^{
//shrink the view
myController.view.transform = CGAffineTransformMakeScale(0.8, 0.8);
//fade in the shadow
myController.view.layer.shadowOpacity = 0.8;
}
completion:^(BOOL finished){
...etc
The view resizes correctly but the shadow appears immediately instead of fading in.
Am I doing something wrong? I thought the shadowOpacity was animatable?
You have to use Core Animations to animate a views layer property: