Uzyskaj tableView: heightForRowAtIndexPath: aby się stało po tableView: cellForRowAtIndexPath :?

Mam kilka UITableViewCells, które muszą zmienić swoją wysokość w zależności od długości napisów wewnątrz. Obliczam niezbędną wysokość wewnątrztableView:cellForRowAtIndexPath:, a następnie przechowywanie go w zmiennej (self.specialRowHeight). Potem mam:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == SPECIAL_SECTION) {
        return self.specialRowHeight;
    }
    else {
        return 44;
    }
}

Tyle że wydaje się, że jest wywoływany przedtableView:cellForRowAtIndexPath: trochę, więc zawsze jest zero.

Czy jest jakiś sposób na to, a może inny sposób?

Dzięki!

questionAnswers(3)

yourAnswerToTheQuestion