gpt4 book ai didi

objective-c - 以编程方式访问 Apple Watch 表冠

转载 作者:太空狗 更新时间:2023-10-30 03:45:48 26 4
gpt4 key购买 nike

我知道它的实际可用时间不到 48 小时,但我想知道是否有人知道如何在 watchOS 2 中以编程方式访问 Apple Watch 上的数字表冠?是否没有我可以覆盖其实现的 Objective-C 方法,例如 -(void)crownMovedWithTimeStamp(float)timeStamp? (我的想法是这个方法可以是 WKInterfaceController 的一个方法,并且会在设定的时间间隔调用(就像每次数字表冠旋转 1 度角时一样))。就像使用 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 等方法在 UIView 中接收触摸一样。任何帮助将不胜感激,谢谢。

最佳答案

在 WatchOS 2 中,Apple 引入了 WKInterfacePicker 类。

来自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 : 转动表冠时的动画

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.

关于objective-c - 以编程方式访问 Apple Watch 表冠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30744960/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com