2012-06-15 67 views
0

我只是在开发绘图应用程序。我需要绘制一条透明线,每当我画线时,我都会出现点。绘制透明时删除虚线

我该如何纠正这个问题?我如何从线上删除点?

我的代码如下这里

- (UIImage *)drawSmoothLine // stright line correct 
{ 
    CGPoint mid1 = midPoint(previousPoint1, previousPoint2); 
    CGPoint mid2 = midPoint(currentPoint, previousPoint1); 

    CGSize screenSize = self.frame.size; 
    UIGraphicsBeginImageContext(screenSize); 

    CGContextRef context = UIGraphicsGetCurrentContext(); 

    [self.layer drawInContext:context]; 


    CGContextMoveToPoint(context, mid1.x, mid1.y); 

    CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y); 

    CGContextSetLineCap(context, kCGLineCapRound); 

    CGContextSetStrokeColorWithColor(context, drawColor.CGColor); 


    CGContextSetBlendMode(context, kCGBlendModeColorBurn); 
    CGContextSetLineWidth(context, lineWidth); 

    CGContextStrokePath(context); 

    UIImage *ret = UIGraphicsGetImageFromCurrentImageContext(); 

    UIGraphicsEndImageContext(); 

    return ret; 
} 

Ipad screen shot of bug http://dc471.4shared.com/img/3_9Uo8qT/s3/Screen_shot_2012-06-15_at_1564.png

回答

0

尝试使用UIBezierPath 看看this link参考,请根据您的需求。 希望这可以帮助你。