必須メソッド②内のタイトル設定での[indexPath.row]はなんとなく
配列内の一番最初を取り出すというのがわかるのですが、
セルオブジェクトを取得するための引数でのindexPathが理解できません。
説明にはセルの位置を指定とあるのですが、indexPathの実体は何なんでしょうか?
よろしくおねがいします。
//tableViewの必須メソッド① func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return xArray.count } //tableViewの必須メソッド② func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { //セルオブジェクト1行を取得する let cell = tableView.dequeueReusableCell(withIdentifier: "itemCell", for: indexPath) //タイトルの設定 cell.textLabel?.text = xArray[indexPath.row] return cell }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/30 04:01
2018/06/30 04:02