如何使用目标c实现苹果表冠代表

时间:2018-05-21 12:54:11

标签: objective-c apple-watch

我正在研究苹果手表应用程序,我需要使用表冠更新标签值。我已经使用swift实现了功能。在swift中我们有一个名为crown序列的属性来实现像左派一样的冠代表  crownSequencer.delegate=self; crownSequencer.focus(); 但是我无法在目标c中实现它的方法,因为目标c没有显示任何名为crownSequencer的属性  任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

可以通过InterfaceController对象访问CrownSequence。

在Objective C中,可以通过以下方式访问它:

- (void)awakeWithContext:(id)context {
    [super awakeWithContext:context];
    // Configure interface objects here.
    self.crownSequencer.delegate = self;
}
- (void)willActivate {
   [super willActivate];
   [self.crownSequencer focus];
}

注意:: [self.crownSequencer焦点]不应该在(void)内调用awakeWithContext:(id)context,否则委托方法不会被调用

在这里您可以找到更多信息

https://developer.apple.com/documentation/watchkit/wkcrownsequencer?language=objc

相关问题