如何使用objective c实现apple watch crown delegate
How to implement apple watch crown delegate using objective c
我正在开发需要使用 crown 来更新标签值的 Apple Watch 应用程序。我已经使用 swift 实现了该功能。在 swift 中,我们有 属性 命名为 crownSequencer 来实现像
这样的皇冠委托
crownSequencer.delegate=self; crownSequencer.focus();
但我无法找到在 objective c 中实现它的方法,因为 objective c 没有显示任何名为 crownSequencer
的 属性
任何帮助将不胜感激。
可以通过 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 focus] 不应在 (void)awakeWithContext:(id)context 内调用,否则将不会调用委托方法
在这里您可以找到更多信息
https://developer.apple.com/documentation/watchkit/wkcrownsequencer?language=objc
我正在开发需要使用 crown 来更新标签值的 Apple Watch 应用程序。我已经使用 swift 实现了该功能。在 swift 中,我们有 属性 命名为 crownSequencer 来实现像
这样的皇冠委托
crownSequencer.delegate=self; crownSequencer.focus();
但我无法找到在 objective c 中实现它的方法,因为 objective c 没有显示任何名为 crownSequencer
的 属性
任何帮助将不胜感激。
可以通过 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 focus] 不应在 (void)awakeWithContext:(id)context 内调用,否则将不会调用委托方法
在这里您可以找到更多信息
https://developer.apple.com/documentation/watchkit/wkcrownsequencer?language=objc