- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
cell.firstLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
cell.secondLabel.text = [NSString stringWithFormat:@"%d", NUMBER_OF_ROWS - indexPath.row];
return cell;
}
的初始化子類,這是蘋果的代碼片段Table View Programming Guide涉及哪些問題,分配和定義UITableViewCell
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
工作正常,並且需要,因爲電池在故事板定義和送花兒給人返回有效的細胞對抗零沒有檢查。
但是,如果我不使用故事板,以編程方式我將如何在我的tableview中使用多個自定義單元格?什麼是參與allocating and initializing MyTableViewCell
請詳細告訴我們這些方法是如何工作的,爲什麼不分配uitableviewcell的init子類,以及如何找到這些方法:p –