我正在尝试实现绘图功能。目前我使用UIBezierPath:缩放后的平滑线
@interface DrawView : UIView {
UIBezierPath *myPath;
}
@end
@implemenation DrawView
-(id)initWithFrame:(CGRect)frame {
//...normal init code
myPath = [[UIBezierPath alloc]init];
myPath.lineCapStyle = kCGLineCapRound;
myPath.lineJoinStyle = kCGLineJoinRound;
myPath.miterLimit = 0;
myPath.lineWidth = 10;
}
在touchesBegan:
我跟踪的startPoint和调用[myPath moveToPoint:myTouch locationInView:self];
在touchesMoved:
我打电话[myPath addLineToPoint...]; [self setNeedsDisplay]
。
我的DrawView是一个UIScrollView的子视图。
我的问题: 当我放大绘图是非常角或像素化。
我想以某种方式重绘图形,使其看起来很漂亮平滑,但我无法弄清楚如何或从何处开始。
我发现这个简单的“解决方案”:
-(void)scrollViewDidEndZooming:(UIScrollView*)scrollView withView:(UIView*)view atScale:(float)scale {
view.layer.contentsScale = scale;
[view setNeedsDisplay];
}
当我实现这样的图纸将zomming后平滑的方法,但应用程序变得很laggy和缓慢的。在scrollView应用程序的高maximumZoomScale
完全膨胀。当我正确理解文档设置contentsScale高于2不是一个好主意,或者以任何方式更改contenscale都不是那么好。
非常感谢发布此链接。它有助于了解石英芯,而不是优化。我必须使用会话视频中的优化步骤。但我认为这不会回答我的缩放问题。非常知道我发现了一些iOS画图的例子,但从来没有放大。 – Sebastian