I use this code to make my
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
If you're unfamiliar with UITableViewCellStyleValue2, the main text is shown, and then the detail text is shown after it, generally in a different color. However, when I do this, my main text is truncated, if it is longer than a short word. I want to force it to not truncate the main text and show the entire main text, and then the detail text after it. How can I do that?
preguntado el 09 de enero de 11 a las 04:01
You'll have to subclass UITableViewCell. You will need to override the
layoutSubviews method to adjust the text label frames as needed. I'm not sure if you will be able to do this using the standard
detailTextLabel properties -- you might have to create your own text labels instead of using those properties.
This isn't exactly what you want, but you can make the text in the main label re-size as it gets longer. Set the
minimumFontSize propiedad en el
UILabel for the main text. That way if the text is too long, it will shrink the font until the minimum size before truncating it. If you need something more complicated, you'll probably have to make your own
uiTableViewCell subclass and lay out your own labels with text sizes.