UITableViewDataSourceプロトコルのCellForRowAtIndexPathメソッドは次のとおりです。私はそのコードをウェブサイトで見ました。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *TableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableIdentifier];
}
cell.textLabel.text = [playersReady objectAtIndex:indexPath.row];
return cell;
}
私の質問は次のとおりです。
ここで定義されたの
cellはなぜ= [tableView dequeueReusableCellWithIdentifier:TableIdentifier];ですか?それはどういう意味ですか?そのコードにコメントすれば、すべてうまくいきます。そのコードは何ですか?うーん...cellinifステートメントは(SimpleTableItem )に等しいnil場合にどのように等しくなりますか?そのコードを書いたのは何ですか?cellTableIdentifierSimpleTableItem
TableIdentifierと等しいのはなぜですか?何のために?