我正在开发iPhone上的草图应用程序.我得到了它的工作,但不是在这里看到的漂亮

我正在寻找任何平滑绘图的建议基本上,我所做的是当用户将手指放在我调用的屏幕上时
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
Run Code Online (Sandbox Code Playgroud)
然后我收集一个阵列中的单个触摸
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
Run Code Online (Sandbox Code Playgroud)
当用户从屏幕上拿出一根手指时,我打了个电话
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
Run Code Online (Sandbox Code Playgroud)
然后我用数字绘制数组中的所有点
NSMutableArray *points = [collectedArray points];
CGPoint firstPoint;
[[points objectAtIndex:0] getValue:&firstPoint];
CGContextMoveToPoint(context, firstPoint.x, firstPoint.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineJoin(context, kCGLineJoinRound);
for (int i=1; i < [points count]; i++) {
NSValue *value = [points objectAtIndex:i];
CGPoint point;
[value getValue:&point];
CGContextAddLineToPoint(context, point.x, point.y);
}
CGContextStrokePath(context);
UIGraphicsPushContext(context);
Run Code Online (Sandbox Code Playgroud)
而现在我想改进绘图更像是"Sketch Book"App

我认为与信号处理算法有关,要重新排列阵列中的所有点,但我不确定.任何帮助将非常感激.
提前谢谢:)
如何在画布元素上自由绘制(使用我的鼠标/手指),就像你可以用铅笔画画一样?
有很多问题需要在画布上实现免费手绘:
所以我认为提出一个参考问题是一个好主意,每个答案都是社区维基,并且包含对一个JavaScript库/纯JavaScript如何在画布上绘画的解释.
答案应该是社区维基并使用以下模板:
## [Name of library](Link to project page)
### Simple example
A basic, complete example. That means it has to contain HTML
and JavaScript. You can start with this:
<!DOCTYPE html>
<html>
<head>
<title>Simple example</title>
<script type='text/javascript' src='http://cdnjs.com/[your library]'></script>
<style type='text/css'>
#sheet {
border:1px solid black;
}
</style>
<script type='text/javascript'>
window.onload=function(){
// TODO: Adjust
}
</script>
</head>
<body>
<canvas id="sheet" width="400" height="400"></canvas>
</body>
</html> …Run Code Online (Sandbox Code Playgroud)