テーブルビューのデリゲートのメモ
swift3へ移行したときに引き数名違ったりしてもビルドエラーにならずに原因探すのに苦労したので。
スニペット登録用の備忘録。
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
/// 0.0だと33pxの余白が発生したので0.1を定義
return 0.1
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
/// 0.0だと33pxの余白が発生したので0.1を定義
return 0.1
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cellIdentifier")!
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
/// セル選択
}