我已經使用uigraphics cgcontext畫線觸摸...但我的線不光滑我的意思是邊緣不光滑,所以任何人都可以建議我如何繪製流暢的線.. ?? 這裏我的代碼是我用來畫線:如何在目標c中順暢地繪製自由手線?
/* touchesBegan */
UITouch *touch = [touches anyObject];
lastPoint = [touch locationInView:imagevw];
/* touchesMoved */
CGFloat width = [mySlider value];
UIGraphicsBeginImageContext(imagevw.frame.size);
[imagevw.image drawInRect:CGRectMake(0, 0, imagevw.frame.size.width,imagevw.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), width);
UITouch *touch = [touches anyObject];
mouseSwiped = YES;
CGPoint currentPoint = [touch locationInView:imagevw];
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
imagevw.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
/* touchesEnded */
/* same here */
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);`
這是我的代碼,我可以畫線放手,但它不是平滑的顯示像素我的意思是邊緣不光滑
我已經試過這仍然這不是光滑....如果你知道任何其他可以請你寄給我,如果任何示例代碼將是非常有益的。感謝advanc .. –