WKInterfaceLabel goes dark after reaching a certain height

I am trying to display a lot of data in a WKInterfaceLabel. At some point, I realized that the label was completely clouded by long texts.

At first I thought that this was due to the number of lines, but after a quick test I realized that the number of lines is not directly dependent on the "dark". Then I started to test the line containing the letter b8926 times, which worked. Setting this number to 8927 again broke the shortcut.

I changed bto i, which allowed more characters; I was able to display 15927, so I knew this was not related to the length of the string. Then I changed the font size to a larger one, and the label darkened again, which led me to the conclusion that it was WKInterfaceLabellimited in height.

My workaround would be to add more than one WKInterfaceLabelto the screen and start recording data as soon as the first is full. BUT I could not find any information on how to get the WKInterfaceLabel size .

How can I get around this character restriction or how to get the height of the label? WKInterfaceGroupdoes not have a property size.

When the label becomes dark, the rest of the InterfaceController remains usable, with scrollability, interactivity, navigation and memory usage up to 36.3, so I think this problem is pretty arbitrary.

Here is the code I 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 table view

+4
source share

Source: https://habr.com/ru/post/1694074/


All Articles