views:

476

answers:

2

I have a UITableViewCell that I would like to add a view to the right (in addition to the accessory view). I tried setting the size of textLabel to be a few pixels narrower but it just resizes it back.

Is there any way to resize textLabel?

A: 

Sorry, I misread your question

My recommendation would be to load your own view for the text and add it to cell.contentView, and set the text in that.

justin
I am trying to change the width of the textLabel not the height of the cell.
David Beck
Yes, sorry; I completely misread your question
justin
Oh, when are you changing the width? In cellForRow?
justin
+3  A: 

The object referenced by the default textLabel property, in UITableViewCell instances of type UITableViewCellStyleDefault, cannot be resized, at least not in my experience. The best idea in these cases is to create your own subclass of UITableViewCell, in code or even with Interface Builder if you want, and give it the layout that you want.

Adrian Kosmaczewski