4
votes

We have a multi-line text-wrapping UILabel with some text in it. At the end of the label we want to always place a UIButton as shown.

enter image description here

What's the simplest way to implement this? The text in the button must not break i.e. the button must flow on to the next line as a unit if there isn't enough space.

1
I would useNSAttributedString instead, it's a little easier to implement for this.Tamás Sengel
thanks @the4kman, attributed string + non-breaking space does the trick.Gaurav Sharma
thanks @SalmanGhumsani, looks useful.Gaurav Sharma
@GauravSharma You can answer your own question too :) , if you think that it may be helpful to others :DPrashant Tukadiya

1 Answers

0
votes

Using an attributed string with non-breaking spaces ("\u{00a0}") works.