IBを使ってUITableViewCellのCellのデザインをする

UITableViewで複数のsubviewを持つような複雑なcellをコードを書いて表示させるのはめんどくさい。どうもIBでやるのは推奨されていないらしいけれど、面倒すぎるのでそこは気にしないことにした。

IBでTableCellをデザイン後、以下のコードのYourCustomCellClassIDYouSetInXIBFileYourXIBNameを作ったものに適当に置き換えてtableView:cellForRow:atIndexPath: method:の中のcellをインスタンス化する所に入れる。

YourCustomCellClass *cell = (YourCustomCellClass *)[tableView dequeueReusableCellWithIdentifier:];
if ( cell == nil )
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed: owner:self options:nil];
id firstObject = [topLevelObjects objectAtIndex:0];
if ( [ firstObject isKindOfClass:[UITableViewCell class]] )
cell = firstObject;
else cell = [topLevelObjects objectAtIndex:1];
}

以下より:
objective c - Is it possible to design NSCell subclasses in Interface Builder? - Stack Overflow