Programmatic Access to Apple Watch Crown

971 views Asked by At

I know it has been available for literally less than 48 hours, but I was wondering if anyone has figured out how to programmatically access the digital crown on the Apple Watch in watchOS 2? Is there not an Objective-C method, such as -(void)crownMovedWithTimeStamp(float)timeStamp, that I can override the implementation of? (My thinking was that this method could be a method of WKInterfaceController and would be called at a set interval (like every time the digital crown is spun an angle of 1 degree)). Like what is done to receive touches in an UIView using the methods such as -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event. Any help would be greatly appreciated, thanks.

1

There are 1 answers

5
ntsh On

Looks like in WatchOS 2, Apple has introduced WKInterfacePicker class.

From the Docs:

The user interacts with a picker by tapping it, using the crown to scroll through items, and tapping again to select an item.

When the user selects a new value, WatchKit calls the picker’s action method to report that new value. The format of the picker’s action method is as follows:

- (IBAction)pickerAction:(NSInteger)index

More Docs : Animation when turning crown

Coordinated interface objects. For sophisticated picker interfaces, you can link the picker to one or more WKInterfaceImage or WKInterfaceGroup objects that contain animated image sequences. As the user turns the Digital Crown to select the next picker item, the picker updates the displayed image in each coordinated object.