小编mat*_*ain的帖子

如何更改在目标c中使用贝塞尔曲线路径移动的对象的矩形

我想用bezier路径移动更改rect:

CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [self createArcPath].CGPath;
shapeLayer.strokeColor = [[UIColor blueColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor clearColor] CGColor];
[self.view.layer addSublayer:shapeLayer];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

// btn.frame = CGRectMake(326, 174, 64, 64);
[btn setBackgroundImage:[UIImage imageNamed:@"Volleyball_Ball.png" forState:UIControlStateNormal];
[self.view addSubview:btn];

// car = [CALayer layer];
// car.frame = CGRectMake(326, 174, 48, 48);
// car.contents = (id)([UIImage imageNamed:@"1453303583_circle_blue.png"].CGImage);
// [self.view.layer addSublayer:car];

CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = [self createArcPath].CGPath;
anim.rotationMode = kCAAnimationRotateAuto;
anim.delegate = self;
anim.repeatCount = …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios

6
推荐指数
0
解决办法
137
查看次数

标签 统计

cocoa-touch ×1

ios ×1