まさか私がエンジニアになるなんて

調べてわからなかったこととつまらない日常をまとめる

warning : Unsupported Configuration: Prototype table cells must have reuse identifiers の解決法

UITableView を Storyboard を利用して作るときによく出るこの warning

Unsupported Configuration: Prototype table cells must have reuse identifiers

要は、 Prototype table cells なのに reuse identifiers が無いということです。

この解決方法は2つあります。

  1. reuse Identifiers を追加する
  2. Prototype table cells じゃなくする

reuse Identifiers を追加する

Storyboard とコードを組み合わせて、動的にセルの中身を変えたいならこちらです。

tableViewCell を選択し、右ペインの↓から Identifier を追加します。

f:id:nano-041214:20161005112541p:plain

するとワーニングが消えます。

あとはコード上で cellForRowAtIndexPath で dequeueReusableCell(withIdentifier identifier: String) の identifier に 先程指定した Identifer 与えることで、 cell を取得できます。

Prototype table cells じゃなくする

Storyboard 上で完結するタイプのテーブルビューならこちらで良いでしょう。

Storyboard 上で tableView を選択し、右ペインの↓から

f:id:nano-041214:20161005112221p:plain

Content > Dynamic Prototypes を Static Cells に変更します。