4

I am trying to display a lot of data in a WKInterfaceLabel. At some point I've realized that the label goes dark entirely at long texts.

At first I thought it's to do with the amount of lines but after a quick test I figured that the amount of lines don't stand in direct correlation to the "going dark"-thing. I then proceeded to test with a string that contains the letter b 8926 times which worked. Setting this number to 8927 again broke the label.

I changed b to i which allowed for more characters; I was able to display 15927 so I knew it's not related to string length. I then changed the font size to a bigger one and the Label went dark again which lead me to the conclusion that the WKInterfaceLabel is limited in its height.

My workaround would be to add more than one WKInterfaceLabel to the screen and start writing data to it as soon as the first one is full BUT I couldn't find any info as to how to get WKInterfaceLabel size.

How can I get around this character limitation or how can I get the height of the label? WKInterfaceGroup doesn't seem to have a size property either.

When the label goes dark, the rest of the InterfaceController remains usable, scrollable, clickable, navigatable and memory usage jumps to 36.3 so I think this issue is rather arbitrary.

Here's the code I've used for testing

//font is set to "Caption 2"
var labelText = ""
//for i in 0...8927 { // breaks with "b"
for i in 0...15927 { //works with "Caption 2" but breaks with "Body" font
    labelText.append("i")
}
self.label?.setText(labelText)

PS: I do not want to use a table view

Trangler
  • 73
  • 5
  • 2
    Welcome to Stack Overflow! This is one of the best questions from a new user that I've ever seen, congratulations. It has a clear MCVE and a layout that is very nice to read. Good luck for finding a solution to this awful bug. – Tamás Sengel Feb 23 '18 at 22:34
  • 1
    Thank you my friend, that's very nice of you! Enjoy your weekend – Trangler Feb 23 '18 at 22:39

0 Answers0