iPhone: change height of UITableViewCell coming from a NIB
- by Stefan Klumpp
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)?