私はチュートリアルをオンラインで行っています。今はセルの表を作成していますが、質問があります。下の2番目の関数tableViewで... indexPathは正確に何ですか?UITableView - indexPathとは何ですか?
もっと重要なことは、関数が呼び出されるたびにindexPathを通って渡される値を更新することをプログラムがどのように知っていますか?
var rowNumber = 0
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 50
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let rowCell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell")
rowCell.textLabel?.text = String(indexPath.row + 1)
return rowCell
}
'UITableView'のリファレンスドキュメントを読んだことがありますか? 'IndexPath'(' NSIndexPath')とは何かに関するセクションがあります。 'IndexPath'のドキュメントも参照してください。 – rmaddy
はい私は文書を読んだり、そうでなければ尋ねなかったでしょう。しかし、ありがとう。 – user7024499