title: scrollToRow in UITableView is not taking to correct position
body: <p>I have a weird issue where <code>scrollToRow</code> in <code>UITableView</code> is not taking to correct position.</p>
  <p>I have a UITableView where I have section and rows. In sections I show the categories and in rows, I show products for those categories. <code>laundryCategoriesList</code> have list of categories and for each categories, I have list of products as a sub-array list inside categories model.</p>
  <p>Below is the code I have.</p>
  <pre><code>laundryItemsTV.sectionHeaderHeight = UITableView.automaticDimension
  laundryItemsTV.estimatedSectionHeaderHeight = screenHeight
      
  laundryItemsTV.rowHeight = UITableView.automaticDimension
  laundryItemsTV.estimatedRowHeight = screenHeight
  
  
  func numberOfSections(in tableView: UITableView) -&gt; Int {
      return laundryCategoriesList.count
  }
  
  func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -&gt; UIView? {
      
      let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: laundryCategoryHeader) as! LaundryCategoryHeader
      headerView.setUpView(categoryObject: laundryCategoriesList[section])
      headerView.setNeedsLayout()
      headerView.layoutIfNeeded()
  
      return headerView
      
  }
  
  func tableView(_ tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -&gt; CGFloat {
      return screenHeight
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return laundryCategoriesList[section].products.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      
      guard let cell = tableView.dequeueReusableCell(withIdentifier: laundryProductCell, for: indexPath) as? LaundryProductCell else {
          return UITableViewCell()
      }
      cell.setUpView(productObject: laundryCategoriesList[indexPath.section].products[indexPath.row])
  
      cell.setNeedsLayout()
      cell.layoutIfNeeded()
  
      cell.selectionStyle = .none
      cell.backgroundColor = .clear
      cell.contentView.backgroundColor = .clear
  
      return cell
      
  }
  </code></pre>
  <p>Above tableview I have <code>UICollectionView</code> which is out of <code>UITableView</code> where I show categories using same array list <code>laundryCategoriesList</code>. On click of this categories, I just need to specific section in this <code>UITableView</code>.</p>
  <p>So below is the code I have when I click on the <code>UICollectionView</code>.</p>
  <pre><code>self.laundryItemsTV.scrollToRow(at: IndexPath(row: 0, section: indexPath.row), at: .top, animated: true)
  </code></pre>
  <p>Now issue is when I click on category, scrolling is not happening exactly to the section of the tableview. It goes up-down. However if I scroll whole <code>UITableView</code> once and then do the click events on categories collection view, all works fine.</p>
  <p>Note that I have <code>contentInset</code> on the tableview as below (just to show the categories horizontal list).</p>
  <pre><code>self.laundryItemsTV.contentInset = UIEdgeInsets(top: self.mainHeightForTopViews, left: 0, bottom: 0, right: 0)
  </code></pre>
  <p>I put click event of <code>UICollectionView</code> inside <code>DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {</code> also but still scrolling is not fine.</p>
  <p>Also note that type of <code>UITableView</code> is <code>Grouped</code></p>
  <p>Any idea what I am missing here OR I am doing something wrong here?</p>