私は次のものを持っていますが、ifステートメントにスコープが設定されているため、cellForRowAtIndexPath
コンパイルされません。cell
これはどう書くのが正しいのでしょうか?
int val=indexPath.row % 2;
if(val==0) {
TRCell *cell = (TRCell*)[tableView dequeueReusableCellWithIdentifier:@"myCell"];
cell.topLabel.text = @"whatever";
cell.subLabel.text = @"down below";
} else {
TROddCell *cell = (TROddCell*)[tableView dequeueReusableCellWithIdentifier:@"cell2"];
cell.subLabel.text = @"down below in sub";
}
return cell;