How We Detect and Save the text Which is Written on iPhone/iPad Touch Screen?

214 views Asked by At

I am having a Table view.
If i Write a Word/Text on the iPhone/iPod Touch Screen by using my Finger.

Here my Task is
How we detect the text Which is written on the Screen?
also How we save that text in my Table ?

Example Link: See this

Actually This is the Code What I Wrote For touchBegun, touchMoved, touchEnd events. This Works fine. But How Can I Achieve the above task?

- (void) touchesMoved:(NSSet *)toucheswithEvent:(UIEvent *)event {
   NSUInteger touchCount = [touches count];
   NSUInteger tapCount = [[touches object] tapCount];
   label.text = @"touchesMoved";
   statusLabel.text = [NSString stringWithFormat:@"%d touches", touchCount];
   tapStatusLabel.text = [NSString stringWithFormat:@"%d taps", tapCount];
} 

- (void) touchesBegan:(NSSet *)toucheswithEvent:(UIEvent *)event {
   NSUInteger touchCount = [touches count];
   NSUInteger tapCount = [[touches object] tapCount];
   label.text = @"touchesBegan";
   statusLabel.text = [NSString stringWithFormat:@"%d touches", touchCount];
   tapStatusLabel.text = [NSString stringWithFormat:@"%d taps", tapCount];
}

- (void) touchesEnded:(NSSet *)toucheswithEvent:(UIEvent *)event {
   NSUInteger touchCount = [touches count];
   NSUInteger tapCount = [[touches object] tapCount];
   label.text = @"touchesEnded";
   statusLabel.text = [NSString stringWithFormat:@"%d touches", touchCount];
   tapStatusLabel.text = [NSString stringWithFormat:@"%d taps", tapCount];
}
1

There are 1 answers

0
TorukMakto On

Your question is highlevel and so I will suggest high level approach which you can chase down.

1) From the app, you have to implement gesture recognizers like

– touchesBegan:withEvent: 
– touchesMoved:withEvent:
– touchesEnded:withEvent:

2) This will give you coordinates or PATH of user's touches. Convert them into memory bitmap using

CGContextRef con = CGBitmapContextCreate(NULL,,rgbColorSpace, kCGImageAlphaPremultipliedFirst);

3) Using the path captured from Step1, draw on bitmap context via CoreGraphics Functions. And finally you will get a UIImage.

4) Use OCR such as Tesseract to get text from image and you should be all set.

Good luck!