swiftでTextViewの行間を変更する
概要
TextViewの行間は、StoryBoardでは変更できないようです。 TextView.attributedTextにstyleを追加します。
けっこう面倒ですね。
@IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() let style = NSMutableParagraphStyle() style.lineSpacing = 40 let attributes = [NSParagraphStyleAttributeName : style] textView.attributedText = NSAttributedString(string: textView.text, attributes: attributes) }