Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:41:05+00:00 2026-06-13T10:41:05+00:00

I am trying to implement a drawing feature. Currently I am using UIBezierPath: @interface

  • 0

I am trying to implement a drawing feature. Currently I am using 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;
}

In touchesBegan: I track the startPoint and call [myPath moveToPoint:myTouch locationInView:self];
In touchesMoved: I call [myPath addLineToPoint...]; [self setNeedsDisplay].

My DrawView is a subview of a UIScrollView.

My problem:
When I zoom in the drawing is very cornered or pixelated.

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.

I’ve found this simple “solution”:

-(void)scrollViewDidEndZooming:(UIScrollView*)scrollView withView:(UIView*)view atScale:(float)scale {
    view.layer.contentsScale = scale;
    [view setNeedsDisplay];
}

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 maximumZoomScale 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:41:06+00:00Added an answer on June 13, 2026 at 10:41 am

    I found a solution for my problem (I’m still facing other problems with drawing…):
    When zooming is finished I call a method that looks like this:

        -(void)redrawWithScale:(float)scale {
            _myPath.lineWidth = _myPath.lineWidth * scale //currently _myPath is a UIBezierPath, with CGPath it should be equal
            [_myPath applyTransform:CGAffineTransformMakeScale(scale, scale)];
    
            [self setNeedsDisplay];
    
            //or with a CAShapeLayer:
            _shapeLayer.path = _myPath.CGPath;
       }
    

    Edit:

    In my current implementation I’m using a CAShapeLayer (as a sublayer of my UIView). The UIBezierPath is set to the path attribute of the shapeLayer.
    Calling setNeedsDisplay isn’t neccessary with this solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a html5 drawing app. Currently, I can allow for
I'm currently trying to implement a silhouette algorithm in my project (using Open GLES,
Hey everyone, So, I'm currently trying the implement the APNG Specification , but am
I'm trying to implement a function that takes a System.Drawing.Bitmap object and renders it
I was trying to implement palm rejection functionality for a drawing app i developed
I'm trying to implement zooming functionality using a UIScrollView in MonoTouch but I just
I'm creating an AutoCAD viewer using directX, and am trying to implement paperspace/modelspace functionality.
As part of a larger project I'm trying to implement a facility using JOGL
I'm trying to implement a stereo camera calibration app using emgu cv. My problem
I'm trying to implement a very simple drawing view in my app. This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.