Storyboard の TableView にカスタム セルを使用するプロジェクトを終了しました。
問題は、下にスクロールすると各セルのコンテンツがなくなることです。私の場合は 2 つのラベルです。
これは、各セルを表示するために使用するコードです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCell";
MessageCell *cell = (MessageCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[MessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
Message *messageForRow = (Message *)[messages objectAtIndex:[indexPath row]];
[cell.messageLabel setText:[messageForRow message]];
[cell.senderLabel setText:[messageForRow sender]];
return cell;
}
ストーリーボードで正しいセル識別子を指定し、クラスをカスタム セル クラスにリンクしました。
何が間違っている可能性がありますか?提示しきれなかった必要な情報があれば教えてください。
よろしくロバート