OGeek|极客世界-中国程序员成长平台

标题: ios - 无法从 WatchKit Controller 更改 View [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:16
标题: ios - 无法从 WatchKit Controller 更改 View

我在 Storyboard 中添加了一堆 WKInterfaceLabels,将它们作为 IBOutlets 添加到 InterfaceController.h 中,并使用 SetText 方法在它们上设置一些文本。但是,我对 View 没有任何改变。控制台为每个标签提供消息“接口(interface)描述中的未知属性”。我该如何解决这个问题?

在 InterfaceController.h 中,我将标签定义如下:

IBOutlet WKInterfaceLabel *hdate;

在 InterfaceController.m 中,我将其文本设置如下:

- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
[hdate setText"blah"];}



Best Answer-推荐答案


由于正确答案在问题的评论中,我将在这里再次发布:

您不能仅使用 .h 文件在 .h 文件中创建 IBOutlet

IBOutlet WKInterfaceLabel *hdate 

在括号中,我必须将它们设置为属性。

(归功于 user3261697)

关于ios - 无法从 WatchKit Controller 更改 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30130320/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4