类似这张图片 当我点击一角时 填充颜色 点击别的地方时在填充颜色
-
(void)drawRect:(CGRect)rect {
for (PathModal *modal in pathModalArray) {
CGContextRef context = UIGraphicsGetCurrentContext();
// if (m_BackgroundImage != nil) {
// CGContextDrawImage(context, CGRectMake(10, 10, 200, 200), m_BackgroundImage.CGImage);
// }
[modal.color setStroke];
// CGContextSetLineWidth(context, modal.width);
// CGContextAddPath(context, modal.path);
//
// CGContextDrawPath(context, kCGPathStroke);
CGContextSetLineWidth(context, modal.width);
CGContextAddPath(context, modal.path);
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
CGContextDrawPath(context, kCGPathFill);
CGContextFillPath(context);}
if (path != nil) {
CGContextRef context = UIGraphicsGetCurrentContext();
if (m_BackgroundImage != nil) {
CGContextDrawImage(context, CGRectMake(10, 10, 200, 200), m_BackgroundImage.CGImage);
}
CGContextAddPath(context, path);[self.lineColor setStroke]; CGContextSetLineWidth(context, self.lineWidth); CGContextDrawPath(context, kCGPathStroke);
}
}
我这么写的 发现画完以后填充颜色 可是我想在画板添加图片后 几点一个框就可以填充颜色 谁知道 求救