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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:02:59+00:00 2026-05-27T08:02:59+00:00

Im new to Objective-C so please bear with me. Im in the process of

  • 0

Im new to Objective-C so please bear with me. Im in the process of creating an iPhone app which has user drawn on the screen while tracing the shape of letter.

So far, I have the TouchesBegan/Moved/Ended and point/point location to draw onto a buffer on the screen. I have also drawn the letter “A” to the screen using line coordinates:

- (void)drawRect:(CGRect)rect
{
    //letter to draw on  
    CGContextRef c = UIGraphicsGetCurrentContext();

    CGContextSetLineWidth(c, 12.0);

    CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();

    CGFloat components[] = {0.0, 0.0, 1.0, 1.0};

    CGColorRef color = CGColorCreate(colorspace, components);

    CGContextSetStrokeColorWithColor(c, color);
    CGContextSetLineCap(c, kCGLineCapRound);
    CGContextSetLineJoin(c, kCGLineCapRound);
    //1
    CGContextMoveToPoint(c, 60, 400);
    //2
    CGContextAddLineToPoint(c, 160, 100);
    //3
    CGContextAddLineToPoint(c, 260, 400);
    //4
    CGContextMoveToPoint(c, 100, 280);
    //5
    CGContextAddLineToPoint(c, 220, 280);

    CGContextStrokePath(c);
    CGColorSpaceRelease(colorspace);
    CGColorRelease(color);
}

The next step that I am trying to figure out is how to see when the user has gone outside the coordinates (or constraints) of the letter which is on the screen. I know I have to find the shortest distance between the point and the line but I dont know how to do this.

Ive also tried to write out some of it in Java (as im more familiar with it) but Im still unsure of whether im taking the correct steps.

static double ERROR_BOUNDS= 0.0;
double dRes = lines.distanceToX(point.location.x, point.location.y);

 if (dRes>= ERROR_BOUNDS)
{

Ive really hit a brick wall with this and i’ll post more code if anyone needs it to clarify anything. Any help would be much appreciated.

  • 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-27T08:03:00+00:00Added an answer on May 27, 2026 at 8:03 am

    You might try making the path an object using CGPath logic and then using CGPathContainsPoint to evaluate if the touch was or wasn’t on the path.

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

Sidebar

Related Questions

I'm new to both Objective-C and the iPhone SDK in general, so please bear
I'm new to Objective-C and iPhone development, and I'm trying to store floating-point values
I am new to Objective C and iPhone development. I am using CoreData on
I am new to Objective C and IOS programming so please be patient with
I'm new to Objective-C, so please don't judge me too much. I was wondering:
New to Objective-C iPhone/iPod touch/iPad development, but I'm starting to discover lots of power
I'm new to objective-c and Im trying to write a little sample app that
I am new to objective c and I guess it has to do with
I'm pretty new to iPhone development and I'm still getting my head around Objective-C,
first of all please let me say that I am quite new to objective

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.