2010-10-13 7 views
1

Comment puis-je limiter la largeur de mon aCell.textLabel et aCell.detailTextLabel. J'ai une grosse chaîne dans textLabel qui se superpose sur ma chaîne de détails. J'ai essayé ceci: aCell.textLabel.width = aCell.width - 250; Mais ça ne fonctionne pas. Toute idée.TableViewCell textLabel largeur problème

Répondre

1

Je l'ai fait de cette façon:

UILabel *theTitle = [[[UILabel alloc] initWithFrame:CGRectMake(10, 10, 200, 25)] autorelease];       
    [theTitle setText:[anObject objectForKey:@"key"];    
    [theTitle setFont:[UIFont fontWithName:[self textLabelFont] size:[[self textLabelFontSize] floatValue]]];     
    [aCell.contentView addSubview:theTitle]; 
1

Je ne suis pas sûr si c'est la meilleure réponse, mais vous pourriez essayer de créer un UITableViewCell personnalisé dans le constructeur de l'interface. C'est ce que j'ai fait la dernière fois que j'ai dû faire quelque chose d'inhabituel à une cellule de table.

DarkDust vient de poster ce tutoriel dans une autre question: http://www.e-string.com/content/custom-uitableviewcells-interface-builder

Questions connexes