我的書告訴我,我應該使用一個UITableView細胞的複用標識符,像這樣UITableView:如何利用單元重用標識符?
//check for reusable cell of this type
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
//if there isn't one, create it
if(!cell){
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault
reuseIdentifier: @"UITableViewCell"];
}
所以從我所看到的,它會檢查,如果我們想要的細胞類型存在,如果是這樣,就會使用它,但如果它沒有,它會創建一個具有所需標識符的。
如果我們有多個單元格樣式(即不同的重用標識符),那麼我們將如何使用它爲我們創建不同的可重用單元格?
然後使用不同的標識符來創建單元格:)'UITableViewCell * cell1 =','UITableViewCell * cell2 ='等 –