あなたの言っていることが理解できれば、プログラマティック ルートが最善の策であると断言できます。IB でカスタム セルを設計し、それらを独自のクラスにリンクできます。そのクラスでは、プログラムで設定できるように、アクセスできるパブリック プロパティを設定できます。
以下は、テーブル ビューの典型的なセル コードです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"code cell"];
// from here you can have some if statements to determine the subclassing of that specific cell
if ([cell isKindOfClass:[CustomCell class]]) {
CustomCell *customCell = (CustomCell *)cell;
customCell.label.text = @"Text";
customCell.image = self.UIImageProperty;
} else if (//Other kind of custom cell) {
}
return cell;
}
これにより、複数のカスタム セルを簡単に表示できます。サブクラス化できるので、これはあなたの人生をずっと楽にしてくれます。各セルのクラスを必要なサブクラスに設定する必要があることを覚えておいてください。
これの利点は基本的なものです。プログラム的には、セルを変更する柔軟性が高く、多数の nib ファイルを作成するよりもセルをサブクラス化する方が簡単です。