0

I want to add a UIButton at the end of a sentence in UIView.

Presently I have a UILabel to display text and a button next to it. Both are subviews to UIView. I get the desired o/p if the sentence spans to 2 lines.

How should I modify it, for it to work properly even if the text changes to 3 or 4 lines given that I cannot change the size of the UIView or the UILabel?

dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
gowtham
  • 73
  • 1
  • 11

1 Answers1

0

It's not really clear to me what you are trying to achieve... anyway maybe with autolayout you could solve your problem: The button will be placed always on the bottom right corner of the label and the width of the label itself will span from 42 to the max available space...

enter image description here

DungeonDev
  • 1,176
  • 1
  • 12
  • 16