3

When using a collectionView on the iPad and rotating it, I call:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)

    collectionView.collectionViewLayout.invalidateLayout()
}

Is it necessary to do the same thing with a tableView?

I got the below code from this older answer

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)

    tableView.beginUpdates()
    tableView.endUpdates()
}
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256

1 Answers1

1

You don’t need update layout when you rotation device. Because tableView will auto adjust cell layout when rotation.

Thanh Vu
  • 1,599
  • 10
  • 14