Buyin Brian
Buyin Brian

Reputation: 2991

WKInterfaceController cancel button

Is there any way to know when the cancel/dismiss button is tapped on the Apple Watch?

- (void)didDeactivate

Is not an option because that is called whenever the watch goes dark. I'm trying to sync data with the parent iPhone app and this makes it tough to cancel an operation on the parent app.

enter image description here

Upvotes: 4

Views: 772

Answers (2)

Cobra
Cobra

Reputation: 369

While you can't get the cancel directly, you can tell which view controller is active (because your code displayed it) and then tell when they switch. So you can set some flags on display and on de-activate, to tell when the view controller with the cancel button goes away.

Think of it another way, if your view controller disappears and another one displays, the activate of the other controller tells you the watch did not sleep.

Upvotes: 3

Mike Swanson
Mike Swanson

Reputation: 3347

Unfortunately, the current version of WatchKit has no method to determine if the Cancel button is tapped. The closest you'll get is the didDeactivate event that you've already mentioned.

Upvotes: 0

Related Questions