UITableViewCell height is not changing in UITableView when changing it in Interface Builder
I am making a custom table cell with InterfaceBuilder. However, when I change the height in IB, the changes are not reflected in the running program. Is there anything else I need to do besides set the heig开发者_如何学JAVAht in IB?
Thanks in advance.
Changing the height of your custom cell in IB is not enough. The height of a row in a UITableView can be controlled in 2 ways
Set the
tableview.rowHeight
property to the desired value if you know all cells will be the same height. You can also set this in IB if i'm not mistaken.Implement the UITableViewDelegate method
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
This method takes precedence, meaning that if you implement this method then the value you set in tableView.rowHeight
is ignored.
精彩评论