datinc
datinc

Reputation: 3552

WatchKit - Get a touch location on a the screen

I am building an iPhone game with a watch extension. On the watch I would like the user to click on an image and I would like to know where on the image the user clicked. Is this possible with watchkit?

Update: In watchOS 3.0 this is no longer an issue. See answer for details.

Upvotes: 2

Views: 477

Answers (2)

Mr_Pouet
Mr_Pouet

Reputation: 4280

With watchOS 3.0, you can now use WKTapGestureRecognizer combined with locationInObject() to get a touch location.

(still no UITouchEvent unfortunately).

Upvotes: 2

Mike Swanson
Mike Swanson

Reputation: 3347

This is not possible with the current version of WatchKit. The closest you could come to this is to detect that the user tapped an image/button. I suppose you could break the original image into smaller images/buttons and lay them out as a larger image, but I'm not sure how the performance would be.

Upvotes: 1

Related Questions