2013-02-25 36 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();