我已經在IB中創建了一個包含2 UIButton
的單元格,並對其進行了分類。我怎樣才能使用它,而不用重新使用它呢? (對於一個小的固定表) 我試着做類似: RaffleResultCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
但這不會顯示我的細胞在UITableView
,只是一個空白的。如何從IB中使用子類別的單元而不重新使用它?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//Where we configure the cell in each row
id currentRaffle = [_winnings objectAtIndex:indexPath.row];
RaffleResultCell *cell = [tableView dequeueReusableCellWithIdentifier:@"raffleResCell"];
if (cell == nil) {
cell = [[RaffleResultCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"raffleResCell"];
}
return cell;
}
'@」無「而不是」無「? – trojanfoe
錯字,謝謝... – Segev
如果你不介意我的問題,是什麼讓你想避免重用?這個願望通常會在你的應用程序的設計中出現問題。 – katzenhut