Hi Quincey thanks for the reply This is my code
class ThirdViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet var scrollView: UIScrollView!
@IBOutlet weak var imageView: UIImageView!
var firstPass:String!
var secondPass:String!
override func viewDidLoad() { super.viewDidLoad()
self.scrollView.minimumZoomScale=1.0
self.scrollView.maximumZoomScale=20.0
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: Selector("tapAction:")) tapGestureRecognizer.numberOfTapsRequired=2
self.imageView.userInteractionEnabled = true
self.imageView.addGestureRecognizer(tapGestureRecognizer) }
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning() / }
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? { return self.imageView }
func tapAction(sender: UITapGestureRecognizer) {
let touchPoint = sender.locationInView(self.imageView)
let Z1:String = String(touchPoint.x)
let Z2:String = String(touchPoint.y)
print( "YES It Works X= " + Z1 + " Y= " + Z2) }
print( "It Works X= " + Z1 + " Y= " + Z2) } }
The image is 6400px X 4100px and I am designing on XCODE 7 on a Mac using El Capitan for an Iphone and Ipad the Imageview is only 320 x 400 and thats the coordinates I am getting with the above code
I am trying to get the coordinates in relation to the image. It is a building plan and I want to double tap on a room and it will know where I have tapped no matter how much I zoom in
I can do this in Android just hoping there is an IOS equivelent
Thanks for the help
Mark