2012-06-15 40 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參考,請根據您的需求。 希望這可以幫助你。