iWatch: WKInterfaceLabel is it possible to stop text from being cut off with “…” at the end of a label?

给你一囗甜甜゛ 提交于 2019-12-07 13:38:29

问题


The text in my WKInterfaceLabel is way too long and causes the text to be cut off with dots at the end. I know for UILabel for iOS you can easily resolve this issue by enabling clip mode. I don't believe there is any way for me to resolve this for watchkit. This is going to force me to use an Image if I can't prevent the text from being cut off. Any tips or suggestions is appreciated.


回答1:


You have a couple options depending on how you want the view to respond. In your interface story board select your label and open the attributes inspector.

Your first option is to change the font to a smaller size. This is more for a static label that you want to style and leave set.

Your second option is to adjust the min scale value, changing this will automatically shrink the text to fit the window up to the value provided. For example if your font size is 12pt and you set the scale to .5, the font will shrink up to 6pt before appending the ellipsis (...).

Your third option is to set the number of lines to 0 (or a higher number). This will move the text down onto the next line.




回答2:


Set the number of lines to 0 and ensure the label and any containing groups are set to fit content.




回答3:


if you want your font size adjust according to label size follow this method

in WKInterfaceTable attribute inspector set min scale to 0

like in screen shoot

Result before Min scale = 0

Result after Min scale = 0

Note: your no of lines also set to 1



来源:https://stackoverflow.com/questions/29989889/iwatch-wkinterfacelabel-is-it-possible-to-stop-text-from-being-cut-off-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!