LoginSignup
1
2

More than 5 years have passed since last update.

UILabel 行間を空ける

Last updated at Posted at 2019-03-28

ストーリーボードの設定でうまくいかないことがあるときはこうする

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 6
paragraphStyle.lineBreakMode = .byTruncatingTail
let stringAttributes: [NSAttributedString.Key : Any] = [
      NSAttributedString.Key.paragraphStyle : paragraphStyle,
      NSAttributedString.Key.font : UIFont.systemFont(ofSize: 15.0)]
let string = NSAttributedString(string: "表示するテキスト", attributes:stringAttributes)
label.attributedText = string
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2