Something like this should get you going.
CGPoint imageViewPoint = [touch locationInView:imageView];
float percentX = imageViewPoint.x / imageView.frame.size.width;
float percentY = imageViewPoint.y / imageView.frame.size.height;
CGPoint imagePoint = CGPointMake(image.size.width * percentX, image.size.height * percentY);
Assuming the UIImageView
is called imageView
the UITouch
is called touch
and the UIImage
is called image
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…