UITableViewの実装メモのまとめです。
ViewControllerとUITableViewのデータの紐付け
ViewControllerにUITableViewDataSource、UITableViewDelegateを継承
ViewController.swift
class ViewController.swift : UIViewController, UITableViewDataSource, UITableViewDelegate {
Storyboardでdatasourseとdelegateを設定
TBD
一覧のセルに動的に情報を設定/表示する
ViewController.swift
func tableView(table: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// Storyboardで設定したTable View CellのIdentifierを設定し、
// Cellに設定するコンポーネントのレンダリング処理を実装
let cell = table.dequeueReusableCellWithIdentifier("", forIndexPath: indexPath)
return cell
}
一覧選択時のイベント
ViewController.swift
func tableView(table: UITableView, didSelectRowAtIndexPath indexPath:NSIndexPath) {
// 一覧のCell選択時イベント内容を実装
}
編集モードがある一覧の実装
TBD