UITableViewCell only updates to correct height when scrolling
<p>I have a dynamic UITableViewCells, some of them at loading the cells are correct height but there are some that only update to correct layout when tableview scrolling up and down.</p>

<pre><code>- (void)viewDidLoad
    self.heightAtIndexPath = [NSMutableDictionary new];
    self.tableView.rowHeight = UITableViewAutomaticDimension;
</code></pre>

<p>Here is my tableView delegates:</p>

<pre><code>    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {


    cell.imageView.file = (PFFile *)object[@"image"];
            [cell.imageView loadInBackground:^(UIImage * _Nullable image, NSError * _Nullable error) {

                cell.imageHeightConstraint.constant = image.size.height / image.size.width * cell.cardView.frame.size.width;
                [cell.imageView updateConstraints];


            }];

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSNumber *height = [self.heightAtIndexPath objectForKey:indexPath];
    if(height) {
        return height.floatValue;
    } else {
        return UITableViewAutomaticDimension;
    }
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    NSNumber *height = @(cell.frame.size.height);
    [self.heightAtIndexPath setObject:height forKey:indexPath];
}
</code></pre>