Ios Can';t从WatchKit控制器更改视图
我在故事板中添加了一堆WkInterfaceLabel,将它们作为IBOutlets添加到InterfaceController.h中,并使用SetText方法设置了一些文本。然而,我的观点没有改变。控制台为每个标签提供消息“接口描述中的未知属性”。我该如何解决这个问题 在InterfaceController.h中,我对标签的定义如下:Ios Can';t从WatchKit控制器更改视图,ios,objective-c,xcode,watchkit,Ios,Objective C,Xcode,Watchkit,我在故事板中添加了一堆WkInterfaceLabel,将它们作为IBOutlets添加到InterfaceController.h中,并使用SetText方法设置了一些文本。然而,我的观点没有改变。控制台为每个标签提供消息“接口描述中的未知属性”。我该如何解决这个问题 在InterfaceController.h中,我对标签的定义如下: IBOutlet WKInterfaceLabel *hdate; - (void)willActivate { // This method is cal
IBOutlet WKInterfaceLabel *hdate;
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
[hdate setText:@"blah"];}
在InterfaceController.m中,我将其文本设置如下:
IBOutlet WKInterfaceLabel *hdate;
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
[hdate setText:@"blah"];}
改变
到
或者将标签重新连接到视图
就我而言,它运行成功。因为正确答案在问题的评论中,我将再次在这里发布: 您不能在.h文件中仅使用
IBOutlet WKInterfaceLabel *hdate
在括号中,我必须将它们设置为属性
(用户3261697的信用证)你能显示你的代码吗?在OP中粘贴了我的代码。你确定你的IBOutlets在interface builder中实际连接了吗?试着在
-(void)awakeWithContext:(id)context
中设置你的文本。我确定这些outlets在IB中连接了(在代码中填充的点也出现在它们旁边)。我还尝试在awakeWithContext中设置文本,但没有效果。在控制台中用谷歌搜索邮件只会显示这篇文章。