In my storyboard file I am designing multiple prototype cells in a UITableView. Each cell has its own unique Cell Identifier.
Depending on the section and the row I dequeue one of the prototype cells in method - tableView:cellForRowAtIndexPath:
For most of the prototype cells I have not changed the Row Height. On my storyboard, their height seems to be determined by the property 'Row Height' under 'Size Inspector' of UITableView.
For one prototype cell I have changed the height through the property 'Row Height' under 'Size Inspector' of the specific UITableViewCell. The checkbox 'Custom' is also checked.
On my storyboard this seem to work well. But during runtime when my cells are being dequeued and added to the TableView, all cells get the default row height.
Now, I am aware of the method tableView:heightForRowAtIndexPath: which is being mentioned in other posts but it seems a little odd to use as I am setting a custom row height in my storyboard already.
Does somebody know why this property is not working? Is this property maybe mend to be used in different situations?
Thanks
If you want to use Interface Builder in Xcode 5 to change the height of the rows in a table view without code you can do it in two places:
Could it be that you're using the second method? Try to use the first method to set the default height of all the rows in the table view and the second to tell Interface Builder about the exceptions.
heightForRowAtIndexPath
is called (for each row of the table) before the cells are displayed, i.e. before cellForRowAtIndexPath
is called. That is necessary to compute the layout of the underlying scrollview, the scroll indicators etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With