Make multi-line UILabel wrap button

I use a storyboard to create mine UIView. But I set the task: I have multi-line UILabel, UIViewand UIButton. I want to make UILabelmy button wrap - the first line of text has a limit on the end of UIButtonanother for super-viewing. And if my UILabel does not have text, I got a view at the bottom of the shortcut, and I need to do this by restricting the view from binding to UIButton, but if I got free space, it's a supervisor. Example screenshot:

enter image description here

I want to jump over the second word after "heel". Sorry for my bad english, hope the picture can help explain my question. Can this be done directly in IB?

+4
source share
2 answers

Perhaps instead of using it, UILabelyou can try UITextViewusing its property textView.textContainer.exclusionPathsto determine the area of ​​the button container to exclude.

Take a look at the sample message code for the selected and editable case .

As far as I remember, you should limit the minimum application deployment target to 7 or later if you use this property.

Hope this helps!

0
source

, , , UILabel drawRect.

- , . UILabel , .

0

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


All Articles