UILabelで作っていたが、後々ハイパーリンクにしたいなどで、
UILabel→UITextViewに変更しなくては。。などというケースの注意点メモ。。。
環境
- Xcode: 11.3.1
- Swift5
・UITextViewのスクロールをオフ
オートレイアウトを使用している場合、スクロールがONだと高さが計算されないので、
以下コードを追記
textView.isScrollEnabled = false
・UITextViewの余白(padding)を削除
実際に文字を表示してみると上下に余白ができてしまう。
以下コードを追記
textView.textContainerInset = .zero