我可以繪製形狀像圓,矩形,線等外部使用我可以繪製形狀像圓,矩形,線等的drawRect方法以外
CGContextRef contextRef = UIGraphicsGetCurrentContext();
或者是強制性的,以使用它的內部只有drawRect
drawRect
方法。 請幫助我,讓我知道如何在drawRect
方法外繪製形狀。 其實我想繼續在touchesMoved
事件上繪製點。
這是我繪製點的代碼。
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(contextRef, 0, 255, 0, 1);
CGContextFillEllipseInRect(contextRef, CGRectMake(theMovedPoint.x, theMovedPoint.y, 8, 8));
當然,創建位圖上下文中,拉入它們,然後創建從這些圖像。 –