在iPhone上使用增加的lineWidth绘制线条

时间:2011-10-28 14:37:48

标签: objective-c ios quartz-graphics

我在iOS上通过抚摸CALayer的路径画一条线。如何用增加的lineWidth(笔划宽度)来划线这条线,这样线的左端比右端更薄? (它必须是一条线,而不是一个形状或封闭的路径,因为我将使用strokeEnd属性。)

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

使用绘图功能。一开始习惯这很烦人,但它确实起作用了。如果您需要帮助,请留下评论

-(void)draw{
     float lineHeight = 5;//change this as you see fit, like set it equal to an incrementing/decrementing variable of your choice...
     glEnable(GL_LINE_SMOOTH);
     glLineWidth(lineHeight); // change this as you see fit
     glColor4ub(255,255,255,255); // change these as you see fit :)
     ccDrawLine(ccp(10,310), ccp(30,310));  // these numbers are probably off, you'll   have to mess with these to get it in the right position :)
        [super draw];
        }