1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swift3.0 tableview セルの高さ自動設定

Posted at

セルの高さの自動計算

hoge.swift
    override func viewDidLoad() {
        super.viewDidLoad()
        // delegateとdataSourceを設定
        recommendTableView.delegate = self
        recommendTableView.dataSource = self

        // tableの高さを自動
        self.recommendTableView.estimatedRowHeight = 60 // 初期値なんでもいい
        self.recommendTableView.rowHeight = UITableViewAutomaticDimension; // 高さ自動設定

オートレイアウトの場合、一番したの要素(部品)にbottomの設定をいれることが必要。
bottomを入れないとセルの高さが低いままになる。

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?