我想用一個特定的圖像在UIImageView中繪製一些圓圈。這就是我要怎樣做:在UIImageView中繪製形狀IOS
UIGraphicsBeginImageContext(self.view.bounds.size);
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);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[photoView addSubview:image];
圓圈繪製精細,但我想在PhotoView中充當面膜吧。所以,如果例如我使用動畫將UIImageView移出UIView,我希望圓圈隨之移動。重要的是座標是相對於整個屏幕的事實。
聽起來像一個自定義的UIView或派生自定義UIImageView給我。 – trumpetlicks 2013-02-26 18:06:19