셀 세부 텍스트를 중앙에 배치하려고합니다.detailTextLabel textalignment
나는 모든 종류의 게시물을 읽었지만 이전 버전의 IOS에 대한 이야기를하고있는 것 같습니다. 나는 게시물의 모든 조합을 시도했지만 그것이 작동하게 만드는 행운이 없다고 생각합니다.
[[cell detailTextLabel] setTextAlignment:UITextAlignmentCenter];
나는 이것을 willDisplayCell과 아래 코드에서 시도했지만 어느 것도 작동하지 않습니다. 두 가지 방법으로 시도해 보았습니다.
이것이 작동하는지 또는 내 센터 기능 (방법)을 만들어야하는지 아는 사람이 있습니까?
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;
자세한 답변을 주셔서 감사합니다. –
나는 또한 세 번째 하위 뷰를 만들 수 있습니까? 아니면 스타일이 그만합니까? –
셀을 사용자 지정할 때 스타일에 대해 걱정할 필요가 없습니다. 원하는대로 할 수 있습니다. – iPrabu