问题
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
?
回答1:
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!
回答2:
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.
回答3:
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"
回答4:
You have to follow these steps respectively to Achieve result like this image.This is a Scrollable View.
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
来源:https://stackoverflow.com/questions/29110184/scroll-long-text-inside-wkinterfacelabel