8

Simple question: is there a way to make a WKInterfaceLabel scroll if its text is too long to fit within the label’s frame? Something akin to a UITextView?

Luke
  • 9,512
  • 15
  • 82
  • 146

4 Answers4

28

You can definitely do this. All you need to do is set the following properties on the WKInterfaceLabel in the Storyboard.

  • Label => Lines = 0 (WatchKit will set the right number)
  • Size => Width = "Relative to Container"
  • Size => Height = "Size to Fit Content"

This will let you scroll to your heart's content. I just mocked it up in a sample app and it works exactly as you would expect.

Hope that helps!

lukas
  • 2,300
  • 6
  • 28
  • 41
cnoon
  • 16,575
  • 7
  • 58
  • 66
  • That’s ALMOST perfect, but what I’m trying to do alongside this is keep the text vertically centred in the watch’s screen. Given the watch’s status bar, I was apply an adjustment to the height of the label to compensate (i.e. cutting 8pt off on the bottom edge to match those on the top that make up the status bar). I wonder if I can maintain that using the Size to Fit option. – Luke Mar 18 '15 at 07:27
  • You won't be able to produce that effect because you would be hardcoding the height and it would end up truncating instead of growing. – cnoon Mar 18 '15 at 15:12
  • This is not working for me. My goal is to scroll the content text of the label inside that label area. And it simply does "Size to Fit" which is not requirement. – Abdul Yasin May 15 '17 at 08:35
5

It isn't possible to have a WKInterfaceLabel scroll its contents. Your only choice is to truncate the text or allow the label to grow and accommodate it.

bgilham
  • 5,909
  • 1
  • 24
  • 39
1

You need to set label's property set height of label as text size

as below

Set Lines Property = 0 (WatchKit auto set the right number)

Set Width = "Relative to Container" & Height = "Size to Fit Content"
dandan78
  • 13,328
  • 13
  • 64
  • 78
bhautikmewada191
  • 653
  • 1
  • 9
  • 20
0

You have to follow these steps respectively to Achieve result like this image.This is a Scrollable View.

enter image description here

I use two groups

Group1: Group1 include image,heading Label,date Label and Group2

Group1 layout is vertical

Width:Relative to Container

Height:Size to Fit Content

Image:

image width:relative to container(0.8)

image height:Fixed(60)

Heading and Date Label:

Width:Relative to Container

Height:Size to Fit Content

Group2: Group2 includes description Label

Group2 layout is vertical

Width:Relative to Container

Height:Size to Fit Content

Description Label:

Width:Relative to Container

Height:Size to Fit Content

Community
  • 1
  • 1