Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing a line through finger touch on iPhone

I do not want any code but I need reference tutorial on how to draw a smooth line on iPhone through finger touch.

After drawing first line when user draws second line how can I find that second line intersects with the first line or not.

Thanks in advance....

like image 451
Mehul Mistri Avatar asked May 31 '11 11:05

Mehul Mistri


People also ask

Can you draw with your finger on iPhone?

Use the Notes app to draw a sketch or jot a handwritten note with your finger. You can choose from a variety of Markup tools and colors and draw straight lines with the ruler.

How do you type a line through it on an iPhone?

Tap and hold the text to select the line in which you wish to strike through. The in-context marking menu will appear. Drag either of the blue bookends to the left or right to narrow or widen your text selection. Tap the strikethrough S icon from the in-context marking menu.

How do I write on my screen with my finger?

Write words Open any app that you can type with, like Gmail or Keep. Tap where you can enter text. Slide your finger across the letters to spell the word you want. Then lift your finger.


1 Answers

I am using this:

   - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      self.currentPath = [UIBezierPath bezierPath];
      currentPath.lineWidth = 3.0;
      [currentPath moveToPoint:[touch locationInView:self]];
      [paths addObject:self.currentPath];
    }

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
      [self.currentPath addLineToPoint:[touch locationInView:self]];
      [self setNeedsDisplay];
    }

    - (void)drawRect:(CGRect)rect {
      [[UIColor redColor] set];
      for (UIBezierPath *path in paths) {
        [path stroke];
      }
    }

You can get related class reference from apple.

like image 184
Arvind Avatar answered Sep 30 '22 12:09

Arvind