セルに字幕テキストを含むテーブルビューを作成しようとしています
問題は、字幕テキストの配置を右に設定しようとすると機能しませんが、メインテキストでは正常に機能することです。
これが私のコードです
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
[[cell textLabel] setTextAlignment:UITextAlignmentRight];
[[cell detailTextLabel] setTextAlignment:UITextAlignmentRight];
cell.textLabel.text = [array objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:18];
cell.detailTextLabel.text = @"test";
return cell;
}
字幕コードを削除すると、位置合わせは正常に機能します
何か案が ?