类似这张图片 当我点击一角时 填充颜色 点击别的地方时在填充颜色
(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);
}
}
我这么写的 发现画完以后填充颜色 可是我想在画板添加图片后 几点一个框就可以填充颜色 谁知道 求救
谁有demo 更好一些 我想学习相关的 可是发现找不到
http://vdisk.weibo.com/s/uyA1pDHiYeB46?category_id=0&parents_ref=uyA1pDHiYeB40,uyA1pDHjvDj29
可以参考的教程。。
我这里有画板的demo