Locations: ImageView not properly placed when row height is scaled

Hi,

I tried to auto scale the height of the Photo row based on the image (pg 224), but when I try to do so, the image no longer is pinned to the top left of the row. Instead, there is a huge gap at the top, and the image is cut off. Do you know if it has something to do with my code? Or do I need to make some adjustments on storyboard?

override func tableView(_ tableView: UITableView,
heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 && indexPath.row == 0 {
return 88

} else if indexPath.section == 1 {
    if imageView.isHidden {
        return 44
    }
    else {
        return (260*(image!.size.height/image!.size.width) + 20)
    }
}

else if indexPath.section == 2 && indexPath.row == 2 {
  addressLabel.frame.size = CGSize(width: view.bounds.size.width - 115, height: 10000)
  addressLabel.sizeToFit()
  addressLabel.frame.origin.x = view.bounds.size.width - addressLabel.frame.size.width - 15
  return addressLabel.frame.size.height + 20
  
} else {
  return 44
}

}

Hi,

Were you able to figure this out? I have been trying still but no luck.