Skip to content

Instantly share code, notes, and snippets.

@MTattin
Last active November 22, 2016 22:10
Show Gist options
  • Save MTattin/7221f5f9ae9aa2f9c4f9e9dea2903197 to your computer and use it in GitHub Desktop.
Save MTattin/7221f5f9ae9aa2f9c4f9e9dea2903197 to your computer and use it in GitHub Desktop.
テーブルビューコントローラーのデリゲートメモ ref: http://qiita.com/MTattin/items/08f648b051ebec45604e
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) {
/// セル選択
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment