user3261697
user3261697

Reputation: 391

Can't change view from WatchKit controller

I added a bunch of WKInterfaceLabels to the storyboard, added them as IBOutlets in InterfaceController.h, and used the SetText method to set some text on them. However, I get no change on the view. The console gives the message "Unknown property in Interface description" for each label. How do I fix this?

In InterfaceController.h, I define the label as follows:

IBOutlet WKInterfaceLabel *hdate;

In InterfaceController.m, I set it's text as follows:

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

Upvotes: 2

Views: 585

Answers (2)

Joris
Joris

Reputation: 6306

Since the correct answer is in the comments of the question, I will just post it here again:

You can't create the IBOutlet in the .h file with just

IBOutlet WKInterfaceLabel *hdate 

in brackets, I have to set them as properties.

(Credits to user3261697)

Upvotes: 3

Seyed Parsa Neshaei
Seyed Parsa Neshaei

Reputation: 3520

Change

IBOutlet

To

@IBOutlet

Or reconnect the label to the view.

In my case, it ran successfully.

Upvotes: -1

Related Questions