0

私はこのコードを使用して円を描いています:

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);

円はUIWindowに追加されますが、UIWindowと同じ座標を維持してUIImageViewに追加したいので、座標がUIImageViewのサイズの外側にある場合、円は表示されません。UIImageView で、ビューの代わりに円をくぼませて描画します。

4

1 に答える 1

0

キャンバス (コンテキスト) から実際に画像を取得し、その画像をイメージビューに設定する必要があります。

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
于 2013-02-25T21:45:26.983 に答える