Multiline UILabel?
J'ai besoin d'insérer à UILabel
de texte multiligne. Je ne les suivants:
NSMutableString * spName = [[NSMutableString alloc ]initWithString:@""];
for (NSUInteger i=0; i<arrEx.count; ++i)
{
ExInfo * exInf = [arrEx objectAtIndex:i];
[spName appendString:[MyObject getName:exInf.spNum]];
[spName appendString:@" "];
[spName appendString:exInf.totalTime];
[spName appendString:@"\n"];
}
CGSize size = [spName sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:constraint
lineBreakMode:UILineBreakModeWordWrap];
[cell.exsInfoLabel setFrame:CGRectMake(CELL_CONTENT_MARGIN, top, CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), size.height)];
[cell.exsInfoLabel setText:spName];
[spName release];
arrEx
se compose de deux éléments, de sorte qu'il devrait être de deux chaînes de caractères. Mais le UITableViewCell
ne contient que la première chaîne.
Dans IB I le nombre de lignes à 0 pour le UILabel cell.exsInfoLabel
.
Vous devez vous connecter pour publier un commentaire.
essayez ceci:
UILineBreakModeWordWrap
est obsolète. Vous pouvez utiliserNSLineBreakByWordWrapping
Les essayer avant de les setText:
Ou: