這更是我要找的不是一個問題發表意見,但..的出列細胞在自定義的UITableView
我有一個tableview中,從一個陣列讀取細胞。我知道這不是真的鼓勵,但我想這樣做,使我的表很容易由其他開發人員配置。
我的問題出在小區出隊。這段代碼完美的工作,但我不禁想到如何寫它是不正確的。如果任何人有任何建議id愛聽到他們?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
DialogViewSection *currentSection = self.sections[indexPath.section];
DialogViewCell *currentCell = currentSection.sectionCells[indexPath.row];
// Configure the cell...
if ([currentCell isMemberOfClass:[EntryCell class]]) {
DialogViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kEntryCellIdentifier];
cell = currentCell;
return cell;
}
else {
DialogViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kBooleanCellIdentifier];
cell = currentCell;
return cell;
}
}
你沒有幫助任何人使用這種方法。使用標準單元出隊。其他開發者學習如何正確地做到這一點更好。它更高效,開發人員將知道它應該如何工作。 – rmaddy
@rmaddy好說。 – Pavan
+1給maddy的評論。不要這樣做。這是一個非常糟糕的主意,並不會以任何方式幫助其他開發人員。任何值得使用它的iOS開發人員都會將代碼從窗口扔出去,並且運行尖叫。任何認爲沒關係的人都會學習錯誤的做事方式。 –