【发布时间】:2012-06-21 10:00:23
【问题描述】:
我正在使用UIBezierPath 绘图,我想为我的路径选择不同的颜色,但发生的情况是所有路径都设置为当前选择的颜色,那么我该如何解决这个问题,下面是我的代码
(void)drawRect:(CGRect)rect
{
if(changecolor)
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
strokeColor = appDelegate.color;
SEL blackSel = NSSelectorFromString(strokeColor);
UIColor* tColor = nil;
if ([UIColor respondsToSelector: blackSel])
tColor = [UIColor performSelector:blackSel];
[tColor setStroke];
[tColor setFill];
**for (UIBezierPath *_path in pathArray)
[_path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];**
}
else
{
[[UIColor redColor] setStroke];
[[UIColor redColor] setFill];
*for (UIBezierPath *_path in pathArray)
[_path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];*
}
}
这里我的 bezierpaths 存储在一个数组中,所以请告诉我应该如何进行
问候 兰吉特
【问题讨论】:
-
您在这个主题上学到了这么多,真是太棒了。伟人:)
-
嗨 aalok 给我你的 emailid
-
好的,谢谢,我会尽快回复您
标签: iphone ios cocoa-touch core-graphics uibezierpath