objective-c - 如何使用objective c实现苹果手表皇冠代表
问题描述
我正在开发需要使用 Crown 更新标签值的 Apple Watch 应用程序。我已经使用 swift 实现了该功能。在swift中,我们有一个名为crownSequencer的属性来实现皇冠委托,
crownSequencer.delegate=self; crownSequencer.focus();
但我无法在目标c中实现它,因为目标c没有显示任何名为crownSequencer
任何帮助的属性,我们将不胜感激。
解决方案
CrownSequence 可以通过 InterfaceController 对象访问。
在 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
推荐阅读
- android - 我能知道输入变量为什么它总是给我错误,非常感谢
- java - 用户输入值后在 Java 中循环
- amazon-web-services - 当 AWS Glue 工作流程完成时,是否可以发布到 SNS?
- javascript - 类似数组/映射的数据结构,具有对项目的唯一 ID 支持、O(1) get() 方法且无重复
- python - 卸载 Python3.8 ,我会丢失所有已安装的软件包吗?
- java - 将日期转换为 LocalDateTime,格式为“yyyy-MM-dd HH:mm:ssXXX”
- c - 如何将具有未知小数的浮点数转换为整数而不会丢失数据?
- python - Selenium Python - 元素拦截错误
- django - Elastic Beanstalk - 从自定义域浏览站点时 - DNS_PROBE_FINISHED_NXDOMAIN
- powerbi - Power BI 动态 csv 文件路径更改