title: Weird behaviour of UITableViewCell after table reload when paging enabled for UITableView
body: <p>I have an <code>UITableView</code> and inside <code>UITableViewCell</code>, I have added view and trying to set the height of that view or height of the cell according to screen height or <code>UITableView</code>'s <code>height</code>. Initially, I was able to do it but when in the <code>viewWillAppear</code> reloading table, not able to set the proper height for that view or height of the cell. It's the height or some other problem, not able to identify. Any help would be appreciated and Thanks for the reply. The title of the question may be confusing or do you find any unrelated code then suggestions(edits) are welcome.</p>
  <p><strong>Code:</strong></p>
  <pre><code>import UIKit
  
  class PageViewController: UIViewController {
      @IBOutlet weak var tblPager: UITableView!
      let screenHeight = UIScreen.main.bounds.size.height
      
      let vColors: [UIColor] = [.red, .blue, .orange, .brown, .cyan, .darkGray, .green, .red, .blue, .orange, .brown, .cyan, .darkGray, .green]
  
      var pageSizeHeight: CGFloat = 0
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          pageSizeHeight = screenHeight - (getTopSafeArea() + getBottomSafeArea() + 54)
      }
     
      override func viewWillAppear(_ animated: Bool) {
          
          super.viewWillAppear(animated)
          
          delay(interval: 10.0) {
              
              print(&quot;Reload table after 10 seconds&quot;)
              self.tblPager.reloadData()
          }
      }
      
  }
  
  //MARK:- TableView Delegate
  extension PageViewController: UITableViewDelegate, UITableViewDataSource {
      
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return vColors.count
      }
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: &quot;PageCell&quot;, for: indexPath) as! PageCell
          cell.backgroundColor = vColors[indexPath.row]
          
          cell.viewHeight.constant = pageSizeHeight
          return cell
      }
      
  }
  
  class PageCell: UITableViewCell {
      @IBOutlet weak var vwPage: UIView!
      @IBOutlet weak var viewHeight: NSLayoutConstraint!
  }
  
  func getTopSafeArea() -&gt; CGFloat {
      let window = UIApplication.shared.keyWindow
      let topPadding = window?.safeAreaInsets.top ?? 0
      return topPadding
  }
  
  func getBottomSafeArea() -&gt; CGFloat {
      let window = UIApplication.shared.keyWindow
      let bottomPadding = window?.safeAreaInsets.bottom ?? 0
      return bottomPadding
  }
  
  func delay(interval: TimeInterval, closure: @escaping () -&gt; Void) {
      DispatchQueue.main.asyncAfter(deadline: .now() + interval) {
          closure()
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vF6PL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vF6PL.png" alt="enter image description here" /></a></p>
  <p><strong>Output:</strong></p>
  <p><a href="https://i.stack.imgur.com/S0zxQ.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S0zxQ.gif" alt="enter image description here" /></a></p>