您的位置:首页 > 其它

画圆圈

2015-12-30 14:49 113 查看

画圆圈

by 伍雪颖



CGPoint CGRectGetCenter(CGRect
rect){

returnCGPointMake(CGRectGetMidX(rect),CGRectGetMidY(rect));

}

@interfaceViewController () {

CAShapeLayer *circleLayer;

}

@property (nonatomic,strong)CADisplayLink
*timer;

@end

@implementation ViewController

- (void)viewDidLoad {

[superviewDidLoad];

circleLayer = [CAShapeLayerlayer];

CGFloat radius =30.0;

UIBezierPath *path = [UIBezierPathbezierPathWithArcCenter:CGRectGetCenter(self.view.frame)

radius:radius

startAngle:-0.5
* M_PI

endAngle:1.5
* M_PI

clockwise:YES];

circleLayer.path = path.CGPath;

circleLayer.strokeColor = [UIColorredColor].CGColor;

circleLayer.lineWidth =3;

circleLayer.fillColor =nil;

circleLayer.contentsScale = [UIScreenmainScreen].scale;

[self.view.layeraddSublayer:circleLayer];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: