0

I am new to IOS development and I have a basic UITableView with rows to display data. The problem I am facing is that UITableView is not reacting to the landscape orientation.

I have the following code which does not work:

override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
    self.tableView.reloadData()
}

I find it quite tricky to find solution on the internet.

Thanks for your help.

FFB
  • 87
  • 7
  • 1
    Sorry but remove this code of line. And Check in project that if project supports portrait and landscape mode. – Kudos Aug 26 '21 at 15:20
  • You have a look to that post, it might clarify few things => https://stackoverflow.com/a/60577486/8780127 – Wilfried Josset Aug 26 '21 at 15:27
  • To explain in detail - there shouldn't be a need to call `reloadData` on a change in orientation. All a change in orientation eans is a change in *layout* (potentially), not *data*. From what your question indicates, your table is either (a) sideways or (b) not displaying it's **unchanged** data properly on an orientation change. –  Aug 26 '21 at 16:42
  • @Kudos where do I check the orientation settings in project? I could not find any. – FFB Aug 27 '21 at 13:10
  • @dfd what do you mean sideways? That the tableview is not rotating? Do you know how I can fix this? I cannot use constraints on the UITableView and the cells – FFB Aug 27 '21 at 13:12

0 Answers0