etiqueta da célula da tabela do iPhone desalinhada
Igual aesta pergunta anteriorEstou tendo um problema com o alinhamento de texto nas células da minha tabela. Todo o texto é deslocado por alguns pixels. Eu não estou usando células personalizadas; Estou usando regularUITableViewCell
s com oUITableViewCellStyleValue1
estilo, segmentação do iPhone OS 3.1. Eu preferiria uma solução muito mais simples do que a resposta da pergunta anterior, especialmente porque não estou usando células personalizadas. Eu também gostaria de saber exatamente qual é o problemaé, uma vez que essa parte da questão nunca foi abordada.
Aqui está o que parece no simulador:
Simulador http://www.shaggyfrog.com/junk/table-cell-label-misalignment-simulator.png
E no dispositivo:
Dispositivo http://www.shaggyfrog.com/junk/table-cell-label-misalignment-device.png
Edit: mais alguns códigos conforme o pedido. (Estou construindo minhas células da tabela fora de cellForRowAtIndexPath.)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [cells objectAtIndex:[indexPath row]];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self loadCells];
[table reloadData];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)loadCells
{
cells = [[NSArray alloc] initWithObjects:[self aCell], [self bCell], nil];
}
- (UITableViewCell*)aCell
{
UITableViewCell* cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"Foo"] autorelease];
cell.textLabel.text = @"A";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (UITableViewCell*)bCell
{
UITableViewCell* cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"Foo"] autorelease];
cell.textLabel.text = @"B";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}