Search code examples
objective-cuitableviewios7xibnib

Getting Height From a XIB


I'm creating a custom UITableViewCell from an xib. However, the cells don't automatically fit the same height I set in the xib file. Is there a way to get the height of the xib in the heightForRowAtIndexPath so that I can accurately set the height without having to hard code it?


Solution

  • Selecting the UITableView on the storyboard, or view etc, within the interface builder you can set the cell height to match your custom cell nib's height.

    Go to the Utilities panel and select the tab as highlighted in blue in the picture below. Set the row height here.

    enter image description here

    I hope this helps with what you are looking for.

    Cheers