iosobjective-cuitableviewheightforrowatindexpath

Difference between estimatedHeightForRowAtIndexPath and heightForRowAtIndexPath?


Hello can anyone help me to know difference between following two methods.

First :

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}

Second :

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}

Thanks in advance.


Solution

  • heightForRowAtIndexPath is the real height. Cell's height is 100.

    estimatedHeightForRowAtIndexPath isn't the real height. The Cell estimates the height as 100. The actual height is then calculated based on the constraint