嗨,有什么方法可以通过按钮以编程方式更改颜色?
>
-(void)drawToBuffer {
// Red Gr Blu Alpha
CGFloat color[4] = {0.0, 0.0, 0.0, 1.0};
if (self.previousPoint != nil) {
CGContextSetRGBStrokeColor(offScreenBuffer, color[0], color[1], color[2], color[3]);
CGContextBeginPath(offScreenBuffer);
CGContextSetLineWidth(offScreenBuffer, 5.0);
CGContextSetLineCap(offScreenBuffer, kCGLineCapRound);
CGContextMoveToPoint(offScreenBuffer, previousPoint.location.x, previousPoint.location.y);
CGContextAddLineToPoint(offScreenBuffer, point.location.x, point.location.y);
CGContextDrawPath(offScreenBuffer, kCGPathStroke);
}
}
这属于 uidraw 视图,我希望在我的应用程序中为 UiDraw 创建一个橡皮擦功能