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 6175813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:59:20+00:00 2026-05-23T23:59:20+00:00

Is there a framework I can use to draw lines with touch. Basically I

  • 0

Is there a framework I can use to draw lines with touch. Basically I want to add ability for a customer to sign on iPad/iPhone and capture it as an image.

Any help much appreciated.

Thanks.

  • 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-05-23T23:59:21+00:00Added an answer on May 23, 2026 at 11:59 pm

    you can meet your requirement by using core graphics available in UIKIT framework.

    i had a similar requirement in my application with a different use ,if needed i can provide you the code.

    TNQ

    .h file

    #import <UIKit/UIKit.h>
    typedef enum _DrawingMode{
    DrawingModePen =0,
    DrawingModeEraser=1,
    } DrawingMode;
    @interface DrawingView : UIView {
    CGPoint lastPoint;
    UIImageView *drawImage;
    BOOL mouseSwiped;   
    int mouseMoved;
    DrawingMode mode;
    UIColor *_drawingPenColor;
    }
    @property (nonatomic, retain) UIColor *drawingPenColor;
    @property (nonatomic) DrawingMode mode;
    
    @property (nonatomic, retain) UIImageView *imageView;
    @property (nonatomic,retain)UIImageView *drawImage;
    @end
    

    .m

    #import "DrawingView.h"
    
    
    @implementation DrawingView
    
    @synthesize mode, drawingPenColor=_drawingPenColor, imageView=drawImage;
    
    
    -(void)initialize{
        drawImage = [[UIImageView alloc] initWithImage:nil];
        self.autoresizesSubviews = YES;
        drawImage.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
        drawImage.frame = self.bounds;
        [self addSubview:drawImage];
        self.backgroundColor = [UIColor clearColor];
        mouseMoved = 0;
        _drawingPenColor = [[UIColor alloc] initWithWhite:0.0 alpha:1.0];
    }
    
    -(void)maskImage:(UIImage *)image withMask:(UIImage *)maskImage 
    {
        CGImageRef maskRef = maskImage.CGImage; 
        CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
                                            CGImageGetHeight(maskRef),
                                            CGImageGetBitsPerComponent(maskRef),
                                            CGImageGetBitsPerPixel(maskRef),
                                            CGImageGetBytesPerRow(maskRef),
                                            CGImageGetDataProvider(maskRef), NULL, false);
        CGImageRef masked = CGImageCreateWithMask([image CGImage], mask);
        UIImage *tempImage = [[UIImage alloc] initWithCGImage:masked];
        //self.clippedImage = tempImage;
        [tempImage release];
        CFRelease(masked);
        CFRelease(mask);
    }
    
    -(void)awakeFromNib{
        [self initialize];
    }
    
    - (id)initWithFrame:(CGRect)frame {
        if ((self = [super initWithFrame:frame])) {
            // Initialization code
            [self initialize];
        }
        return self;
    }
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
        mouseSwiped = NO;
        UITouch *touch = [touches anyObject];
    
        if ([touch tapCount] == 2) {
            drawImage.image = nil;
            return;
        }
    
        lastPoint = [touch locationInView:self];
        //lastPoint.y -= 20;
        NSLog(@"touches begin");
    
    }
    
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        mouseSwiped = YES;
    
        UITouch *touch = [touches anyObject];   
        CGPoint currentPoint = [touch locationInView:self];
        //currentPoint.y -= 20;
    
    
        UIGraphicsBeginImageContext(self.bounds.size);
        [drawImage.image drawInRect:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
        CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
        CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
        if (mode == DrawingModePen) {
            NSLog(@"drawing");
            CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [_drawingPenColor CGColor]);
        }
        else {
            CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [[UIColor clearColor] CGColor]);
    
            CGContextBeginPath(UIGraphicsGetCurrentContext());
    
    
            CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
            CGContextClearRect (UIGraphicsGetCurrentContext(), CGRectMake(lastPoint.x, lastPoint.y, 20, 20));
            CGContextStrokePath(UIGraphicsGetCurrentContext());
    
            NSLog(@"clearing");
                }
        CGContextBeginPath(UIGraphicsGetCurrentContext());
        CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
        CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
        CGContextStrokePath(UIGraphicsGetCurrentContext());
        drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    
        lastPoint = currentPoint;
    
        mouseMoved++;
    
        if (mouseMoved == 10) {
            mouseMoved = 0;
        }
    
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    
        UITouch *touch = [touches anyObject];
    
        if ([touch tapCount] == 2) {
            drawImage.image = nil;
            return;
        }
    
    
        if(!mouseSwiped) {
            UIGraphicsBeginImageContext(self.bounds.size);
            [drawImage.image drawInRect:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
            CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
            CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
            CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
            CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
            if (mode == DrawingModePen) {
                CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [_drawingPenColor CGColor]);
            }
            else {
                CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [self.backgroundColor CGColor]);
            }
            CGContextStrokePath(UIGraphicsGetCurrentContext());
            CGContextFlush(UIGraphicsGetCurrentContext());
            drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();
        }
    }
    
    - (void)dealloc {
        [drawImage release];
        [_drawingPenColor release];
        [super dealloc];
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there a free framework which I can use to develop a web analytics
Is there a framework that can be used to enable a C# Windows Service
Is there any class in the .NET framework that can read/write standard .ini files:
Is there a SSCLI equivalent for .Net Framework 3.5? Something that can be debugged
Under the .NET Compact Framework, there is no FormWindowState.Minimize value. How can I minimize
Entity Framework has created the required partial classes. I can add these partial classes
I just started on the .net compact framework. I want to draw a Sudoku
When using the Entity Framework there are basically two ways to create your model.
I want to use jFugue to play some MIDI music in an applet. There's
I'm looking for a javascript unit test framework that I can use as part

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.