0

My question is related to solving a problem and also to improve my understanding of swift.

I have a UILabel and a TextView. I have the same size font in both. However, in the TextView I am using attributed strings. The fonts appear the same but the line spacing is greater in the label. My problem is I cannot find a way to change the line spacing in the Label other than switching to Attributed String for the Label or for that matter even determining what the present spacing is.

Q1: Is there no other way to control the label spacing other than Attributed Strings?

Q2: Because of issues like this, should I be thinking that Attributed Strings might be a "best practice" regardless -- to give more control?

jz_
  • 338
  • 2
  • 14
  • Q1: Exactly - you should use attributed strings if you want to fine-tune things like line spacing. Q2: No. If you don't need special formatting, use regular text, as it consumes less power. If you have lots of labels, a little goes a long way. – Tamás Sengel Apr 13 '18 at 16:13
  • Possible duplicate of [How to control the line spacing in UILabel](https://stackoverflow.com/questions/5494498/how-to-control-the-line-spacing-in-uilabel) – Tamás Sengel Apr 13 '18 at 16:13
  • Thank you. The comment about consuming less power helps me understand why to use the UILabel if possible. – jz_ Apr 13 '18 at 19:01

1 Answers1

1

You can set linespacing in Label Attribute inspector. See screenshot.enter image description here

Dmitry
  • 2,963
  • 2
  • 21
  • 39