I have a UITableViewCell (really a subclass) defined in a NIB. In the NIB I\'ve set the frame height to 183, I also set the \"Row Height\" to 183 and ticked off custom.
First UITableViewDelegate method, which gets called is heightForRowAtIndexPath not the UITableViewDataSource method, cellForRowAtIndexPath.
You can get your custom cell height only in cellForRowAtIndexPath, where you alloc-init that cell. So, it won't consider custom cell height over here.
It will take the height for the cell which is mentioned in heightForRowAtIndexPath method only. As it gets called first.
You can use this example code to get cell height from NIB
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [[[[NSBundle mainBundle] loadNibNamed:@"ELConvCurListViewCell" owner:self options:nil] objectAtIndex:0] bounds].size.height;
}
Update: You can get and assign height of NIB once time in the viewDidLoad
to the cellHeight
variable and in the heightForRowAtIndexPath
use return cellHeight