2013-02-25 80 views
0

我使用此代码画一个圆圈内的形状:绘制一个UIImageView IOS

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添加,但我希望它在一个UIImageView添加,保持相同的坐标UIWindow,所以如果坐标超出了UIImageView的大小,圆圈将不会被看到。在UIImageView中,在视图上简单地绘制圆。

回答

0

您需要从画布(上下文)中实际获取图像并在图像视图中设置该图像。

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();