【发布时间】:2011-12-06 20:13:48
【问题描述】:
我用贝塞尔曲线画了一个圆,我用这个圆作为 uiimage 视图的遮罩。现在,我如何在不使用触摸移动圆圈的情况下移动圆圈内的图像。 这是我的代码。
CAShapeLayer *maskLayer = [CAShapeLayer layer];
aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(220, 220)
radius:170
startAngle:0
endAngle:DEGREES_TO_RADIANS(360)
clockwise:YES];
maskLayer.backgroundColor = [[UIColor clearColor] CGColor];
maskLayer.path = [aPath CGPath];
maskLayer.masksToBounds=YES;
imageView1.layer.mask = maskLayer;
[self.view addSubview:imageView1];
【问题讨论】:
-
使用
[UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,0,220,220)];可能比bezierPathWithArc...容易很多
标签: objective-c cocoa-touch ipad uiimageview bezier