Я пытаюсь отцентрировать текст с подробностями ячейки.
Я прочитал все виды сообщений на эту тему, но, похоже, все они говорят о старых версиях IOS.Я думаю, что я попробовал каждую комбинацию сообщений, но не повезло, что она заработала.
[[cell detailTextLabel] setTextAlignment:UITextAlignmentCenter];
Я попробовал это из willDisplayCell, а также в приведенном ниже коде, ни одна из них не работает.Обратите внимание, 2 способа сделать это я попробовал в обоих методах.
Кто-нибудь знает, работает ли это или я должен создать свою собственную функцию (метод) центра?
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18.0];
cell.detailTextLabel.font = [UIFont systemFontOfSize:16];
NSMutableDictionary *curRow = [myData objectAtIndex:indexPath.row];
cell.textLabel.text = [curRow objectForKey:@"Description"];
cell.detailTextLabel.text = [curRow objectForKey:@"Stats"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.textAlignment = UITextAlignmentCenter;