简体   繁体   中英

How to get image coordinates in iOS app?

I have to implement a signature functionality in my iPad app. I convert the signature into image and after that I want to get coordinates of that image. How could I do it plz help me.

Note: I am not talking about latitude and longitude. I am talking about pixels coordinates

UIViewController is a subclass of UIResponder , so you can implement the methods touchesBegan:withEvent: , touchesMoved:withEvent: , touchesEnded:withEvent: and touchesCancelled:withEvent: to detect "signing movements".

For example using the method -touchesMoved:withEvent:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint currentPosition = [touch locationInView:self.view];
    NSLog(@"%@", NSStringFromCGPoint(currentPosition));
}

For more info check the documentation of the UIResponder class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM