Ben A. Ben A. - 1 year ago 71
Swift Question

How to have text displayed like a text view on watchOS

I am making an Apple Watch app for the first time.

I noticed that there was no option for a text view. How would I get the text to be displayed as it would in a text view? I want the string to be separated into lines so that it fits, and I want to be able to scroll if the input is long enough.

Is there a way to achieve this without a text view (or am I just not seeing the option for a text view)?

Answer Source

You can accomplish this by using a WKInterfaceLabel.

By setting its numberOfLines to 0, and height to "Size to Fit Content," the label text will scroll when it is large enough to exceed the screen size.

enter image description here

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download