3

私はこのように円を描いています:

CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, 2.0);
//CGContextSetRGBFillColor(contextRef, 0, 0, 1.0, 1.0);
//CGContextSetRGBStrokeColor(contextRef, 0, 0, 1.0, 1.0);
 CGContextSetStrokeColorWithColor(contextRef, [color CGColor]);
CGRect circlePoint = (CGRectMake(coordsFinal.x, coordsFinal.y, 50.0, 50.0));

CGContextFillEllipseInRect(contextRef, circlePoint);

円の内側を空にして、円の後ろにあるものが見えるようにする方法を知りたかったのです。

4

2 に答える 2

8

あらすじだけ欲しいということですか?CGContextStrokeEllipseInRectその場合に使用します。

CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, 2.0);
CGContextSetStrokeColorWithColor(contextRef, [color CGColor]);
CGRect circlePoint = (CGRectMake(coordsFinal.x, coordsFinal.y, 50.0, 50.0));

CGContextStrokeEllipseInRect(contextRef, circlePoint);
于 2013-02-25T21:13:40.317 に答える
2

スイフト3

let currentContext = UIGraphicsGetCurrentContext()
currentContext?.setLineWidth(2.0)
currentContext?.setFillColor(color.CGColor)
let circleRect = CGRect(x: coordsFinal.x, y: coordsFinal.y, width: 50.0, height: 50.0)

currentContext?.strokeEllipse(in: circleRect)
于 2017-02-27T02:29:01.863 に答える