iPhone: change height of UITableViewCell coming from a NIB
Posted
by Stefan Klumpp
on Stack Overflow
See other posts from Stack Overflow
or by Stefan Klumpp
Published on 2010-04-30T11:45:49Z
Indexed on
2010/04/30
12:27 UTC
Read the original article
Hit count: 339
iphone
|uitableviewcell
I have a UITableView of custom UITableViewCells which looks like this:
[ CELL 0
[ description ]
[ dynamic content type 1 ]
[ dynamic content type 2 ]
[ dynamic content type 3 ]
]
[ CELL 1
[ description ]
[ dynamic content type 1 ]
[ dynamic content type 3 ]
]
[ CELL 2
[ description ]
[ dynamic content type 2 ]
]
[ ... and so on ... ]
Since the [description] part is already pretty complex I decided to use Interface Builder to design it and at add the [dynamic content] in the cellForRowAtIndexPath
programmatically with [cell addSubview:...]
. My problem is now, that I set a default height for my custom UITableViewCell in Interface Builder, but when I add my [dynamic content] (which might range between 0..3) I have different cells with different heights.
One thing is of course to calculate the total height and change the return value in heightForRowAtIndexPath
, but how do I change the height value of my actual cell
(which was loaded from a nib file with a fixed height)?
© Stack Overflow or respective owner