2 つのタグ付きラベルを含む UITableViewCell を読み込んでいます。ユーザーは、次のコードを含む現在のビューを離れ、別のビューに移動します。そこで名前の値が設定され、ユーザーはこのビューに戻ります (以下のコード)。他のビューで設定した名前を名前ラベルに割り当てます。それは機能しますが、新しいラベルが他のラベルの上にずれて表示されます。このセルの 2 つのバージョンを保持しているようです。よくわかりません。そのような動作を引き起こしている可能性のあるものについて何か提案はありますか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = nil;
if(indexPath.section == 0)
{
cell = [tableView dequeueReusableCellWithIdentifier:@"CellNameIdentifier"];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CellentName" owner:self options:nil];
cell = cellName;
//self.cellName = nil;
}
}
return cell;
}
- (void)viewDidAppear:(BOOL)animated {
UILabel *startdate = (UILabel *)[cellName viewWithTag:1];
startdate.text = aName;
[super viewDidAppear:animated];
}