LoginSignup
4
6

More than 5 years have passed since last update.

【Swift】長文を表示するUITextViewがスクロールされた状態の時

Posted at

いろいろ調べたけどなかなか動かなかったのでメモ。
文章量によってずれる位置が変わると思うので、-100ってところを調整。

UIViewController.swift
    @IBOutlet weak var txt_LongLongText: UITextView!

    override func viewDidLoad() {
        super.viewDidLoad()
        txt_LongLongText.setContentOffset(CGPointMake(0, -100), animated: false)
    }

UITextView 上寄せ とか
UITextView スクロールされてる とかで調べたんですが、試してもうまくいかなかったです。
結局UIScrollView関連で調べて上記の関数でセットしてたのでそれで対応済みとします。

4
6
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
4
6