#author("2016-05-30T14:43:41+09:00","default:wikiwriter","wikiwriter") [[UIKit/テーブル]] &tag(UIKit/テーブル/Static Cellsを使用する); *目次 [#b039cbe3] #contents *関連ページ [#t0dd0dba] *参考情報 [#rdb588bd] *Static Cellsを使用する [#r096f901] **概要 [#y9b2f263] -[[[iOS 8] storyboard で作成した Static Cells にコードからアクセスする | Developers.IO:http://dev.classmethod.jp/references/ios-8-staticcells/]] -Static Cellsのテーブルを利用すると、ストーリーボードを使って行の定義ができて便利。 -ただしUITableViewControllerじゃないと使えない。 **基本的使用方法 [#x93c4998] -Table View Controllerをストーリーボードにドロップ。Attributes InspectorでContentを「Static Cells」に変更する。 -内部のTable View Cellを選択し、LabelのTextをプレインに変更すると画面から行を設定できる。 -セクションの数や行の数はTable Viewや、Table View SectionのAttributes Inspectorで変更できる。 **クラスを割り当てる場合 [#k70bb7f3] -UITableViewControllerのサブクラスを割り当てる場合、以下の部分はコメントアウトする(そうしないとストーリーボードの設定が無視されてしまう)。 #pre{{ override func numberOfSectionsInTableView(tableView: UITableView!) -> Int { return 1 } override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { return self.items.count } }}