Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Aquis

macrumors member
Original poster
Aug 7, 2007
63
0
Staffordshire, UK
Hello all, I have a UITableViewCell in a table with a UILabel for an accessoryView. After assigning the label as the accessory view, I use the sizeToFit method on it to space it out nicely. Unfortunately, when the accessory view is quite long (and, possibly, the main label as well), the label of the UITableViewCell is cropped to make room for the accessoryView label. This results in things like:

picture1sr0.png

Though I'd like the main label (which fully says "Engineer") to take priority, and have the accessory label be something like "Ingenieurbuero St...", etc.

I've tried going into the cell using by finding the UITableViewCell's relevant subviews and resizing them, but it doesn't appear to make any effect...

Thanks for any help!
 
There's no requirement to use accessoryView or the other preexisting contentView stuff. Just add your own subviews to the contentView and make them whatever size you need. The TableViewSuite sample code does this.

Having said that, making things look good when you have a label and value and the label and value may be arbitrary length is a problem. You may need multiple line UILabels and you may want to use adjustsFontSizeToFitWidth to make the label or value small enough to fit well.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.