![](https://img-blog.csdn.net/20171020165811709?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM2MDg3NDg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
#define SCREENW [UIScreen mainScreen].bounds.size.width
#define SCREENH [UIScreen mainScreen].bounds.size.height
#define XY SCREENW/414
self.timeLB = [[UILabel alloc]initWithFrame:CGRectMake(-50,-20, 100, 40)];
self.timeLB.layer.anchorPoint = CGPointMake(0, 0);//设置锚点
self.timeLB.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.timeLB];
self.timeLB.text = @"23:33";
self.timeLB.textAlignment = NSTextAlignmentCenter;
self.timeLB.textColor = [UIColor blackColor];
self.timeLB.font = [UIFont systemFontOfSize:30*XY];
CAKeyframeAnimation * rectangleTransformAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
rectangleTransformAnim.values = @[[NSValue valueWithCATransform3D:CATransform3DIdentity],
[NSValue valueWithCATransform3D:CATransform3DMakeScale(3, 3, 1)],
[NSValue valueWithCATransform3D:CATransform3DIdentity]];
rectangleTransformAnim.keyTimes = @[@0, @0.494, @1];
rectangleTransformAnim.duration = 2;
CAKeyframeAnimation * rectangleOpacityAnim = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
rectangleOpacityAnim.values = @[@1, @0.5, @1];
rectangleOpacityAnim.keyTimes = @[@0, @0.488, @1];
rectangleOpacityAnim.duration = 2;
CAAnimationGroup *aniGroup = [CAAnimationGroup animation];
aniGroup.duration = 3;
aniGroup.animations = @[rectangleTransformAnim,rectangleOpacityAnim];
aniGroup.repeatCount = 1;
[self.timeLB.layer addAnimation:aniGroup forKey:nil];
想要了解更多请关注公众号