0
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 1 year has passed since last update.

UITableViewについてのメモ

Posted at

まー覚えてられないのでメモ。途中だけど一旦あげ。サイレント修正します。

xibの作成

  1. New File > [cocoa touch class] から UITableViewCellを選択し、「create xib file」みたいなチェックボックスにチェックを入れる
  2. ファイルをターゲットしてIdentiferを設定

UITableViewとxibの接続

  1. ViewControllerにUITableViewを配置(あとで画像載せる)
  2. ViewControllerの viewDidLoad() に以下を書く。
self.テーブル名.register(UINib.init(nibName: "xibファイル名", bundle: nil), forCellReuseIdentifier: "xibファイルのIdentifer")

// delegate, datasource
self.テーブル名.delegate = self
self.テーブル名.datasource = self

UITableViewのプロトコル



TableViewCellの高さ

可変にするのって大変なのかなーって思ってた時期もありました。

// 基準になる高さ
self.テーブル名.estimatedRowHeight = 40
// オートで高さを決めてくれる
self.テーブル名.rowHeight = UITableView.automaticDimension
0
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
0
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?