Note that there are some explanatory texts on larger screens.

plurals
  1. POSmooth line after zooming
    primarykey
    data
    text
    <p>I am trying to implement a drawing feature. Currently I am using UIBezierPath:</p> <pre><code>@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; } </code></pre> <p>In <code>touchesBegan:</code> I track the startPoint and call <code>[myPath moveToPoint:myTouch locationInView:self];</code> In <code>touchesMoved:</code> I call <code>[myPath addLineToPoint...]; [self setNeedsDisplay]</code>.</p> <p>My DrawView is a subview of a UIScrollView.</p> <p><strong>My problem</strong>: When I zoom in the drawing is very cornered or pixelated.</p> <p>I want to redraw the drawing in a way so it looks nice and smooth, but I can't figure out how or where to start. </p> <p>I've found this simple "solution":</p> <pre><code>-(void)scrollViewDidEndZooming:(UIScrollView*)scrollView withView:(UIView*)view atScale:(float)scale { view.layer.contentsScale = scale; [view setNeedsDisplay]; } </code></pre> <p>When I implement the method in this way the drawing will be smoother after zomming, but the App becomes really laggy and slow. At a high <code>maximumZoomScale</code> of the scrollView the App crahes completely. When I understand the docu correctly setting contentsScale higher than 2 isn't a good idea or changing contensScale in any way isn't so good.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload