Questions tagged [wkinterfacelabel]

In iOS Watchkit, a WKInterfaceLabel object lets you manipulate the contents of an onscreen label at runtime. Use a label object to set a new text string for the label.

A WKInterfaceLabel object lets you manipulate the contents of an onscreen label at runtime. Use a label object to set a new text string for the label. The string you specify can use the default styling you specified at design time, or you can use an attributed string to add custom styling to the text.

Do not subclass or create instances of this class yourself. Instead, define outlets in your interface controller class and connect them to the corresponding objects in your storyboard file. For example, to refer to a label object in your interface, define a property with the following syntax in your interface controller class:

SWIFT

@IBOutlet weak var myLabel: WKInterfaceLabel!

OBJECTIVE-C

@property (weak, nonatomic) IBOutlet WKInterfaceLabel* myLabel;

Apple Documentation

40 questions
1
vote
2 answers

WKInterfacelabel check if truncated

I would like to check if the text in WKInterfacelabel is truncated. Since there is no text property and it seems I can not get the number of lines property that you can set in storyboard I wonder if there is any way or trick on how to achieve…
Kreuzberg
  • 894
  • 1
  • 9
  • 18
1
vote
1 answer

How to access the text property of a WKInterfaceLabel in Apple Watch app

I want to type an if statement in the InterfaceController which basically goes like- if label.text == "Hello" { //execute some code } But the WKInterfaceLabel just seems to have the setText() property. So how can I access the WKInterfaceLabel's…
Krish Wadhwana
  • 1,544
  • 2
  • 12
  • 24
1
vote
2 answers

WKInterfaceLabel in custom WKInterfaceTable row unwrapping to nil

The title sums it up. I've tried disconnecting/reconnecting all the IBOutlets. Here's the code on my InterfaceController where I set up the WKInterfaceTable: func setupLoadingTable () { self.myTable.setNumberOfRows(1,…
JustAnotherCoder
  • 2,565
  • 17
  • 38
1
vote
2 answers

How to get the text out of a WKInterfaceLabel

It seems that labels are a bit different on the Apple Watch! I have the following label created : @IBOutlet weak var playerNameLabel: WKInterfaceLabel! Then writing the label is no problem (with the "setText" method) let someString =…
iKK
  • 6,394
  • 10
  • 58
  • 131
1
vote
1 answer

WKInterfaceLabel Text Alignment?

In InterfaceBuilder there's a property for Text Alignment, although it can't be found between the WKInterfaceLabel class defined properties. When I set it to any of the alignments it works, except for the Justified one, why is that the case? Is…
Kex
  • 776
  • 10
  • 22
1
vote
1 answer

WKInterfaceLabel won't scroll when it is inside a group

Whenever I set my WKInterfaceLabel lines to 0 with the height "size to fit content" I am able to scroll through text whenever there is a lot. However, if I put the same label inside a group, I can longer scroll through the label text. Is there a…
William Alex
  • 385
  • 1
  • 3
  • 14
1
vote
2 answers

Watchkit: Is it possible to add an image behind a WKInterfaceLabel?

I am trying to add an orange circle with a number (my number will change depending on certain circumstances) inside it in my WKInterfaceGroup like the image below. However, it appears you can't change WKInterfaceLabel background color. The only…
Danger Veger
  • 1,117
  • 1
  • 9
  • 16
1
vote
1 answer

WatchKit detect tap / touch on label / group

I have a nested WKInterfaceGroup with a WKInterfaceLabel within as such: which looks like that: the orange highlight indicates which part of the value the user is currently editing. (Backgroundcolor of WKInterfaceGroup) i am trying to find a way…
Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69
1
vote
2 answers

WatchKit, AttributedString formatting not working

I am building my first WatchKit App and am having troubles with NSAttributedString formatting as it does not seem to work as I'd expect ;) This is my code: UIFont *textFont = [UIFont fontWithName:@"Menlo" size:30]; UIFont *hlFont = [UIFont…
1
vote
1 answer

WatchKit User Interaction with a Label

While programming an app to time speeches, I realized that I wanted to be able for a person to pause the timer whenever they would like by simply tapping on the timer (a simple WKInterfaceLabel that updates). I already know how to create a timer and…
1
vote
1 answer

Compare WKInterfaceLabel Text to Another NSString

I know there is no getter method for WKInterfaceLabel, but is there another way for me to compare the label text to another string? If this wasn't a watch app and I was using UILabel I could just do this: if ([self.label.text…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
1
vote
2 answers

NSString sizing does not account for Greek breathing marks

I've got an app that displays Greek text. I use the Cardo font for good display. In working on an AppleWatch extension and app, it was pointed out to me that some of the special characters are being cut off. This is how some example text should…
Tom Hamming
  • 10,577
  • 11
  • 71
  • 145
0
votes
1 answer

Left align some rows, right align others in WKInterfaceTable?

I'm trying to display a user's messages in a watchOS app and I'm using a WKInterfaceTable instance to do so. I would like outgoing messages to be right-aligned and incoming messages to be left-aligned but I can't get it to work. Here is the code I'm…
0
votes
0 answers

How can i set lineBreakMode to wordwrap in WKInterfaceLabel?

Can anyone help me to set a lineBreakMode to wordWrap in WKInterfaceLabel in my watch app? I tried with setAttributedText but didn't get any success. Here is my code for the same. I am using swift as programming language. let font =…
Dipen STL
  • 41
  • 3
0
votes
2 answers

Why is WKInterfaceLabel text not refreshing

The WatchApp receives data from the iPhone. I refresh the label text with the data received, nothing happens, the UI is not refreshing. Other threads suggested pushing it to the main thread and that seems to do nothing either. Any thoughts most…
Guy
  • 361
  • 2
  • 14