Search code examples
iosuitableviewuisplitviewcontroller

Transparent space above 1st section in table view after rotate


I have a split view controller, as the master view I have a UIViewController. That UIViewController has a toolbar and a tableview inside it.

If I rotate the the split view to portrait and then back to landscape I see a space above the tableview that is transparent. When I scroll the tableview up a little I see the table contents appear in that space.

Whats weird is that it only happens when I rotate the device and then rotate back again. The table view is fine at first but something seems to get messed up after a couple of rotations.

Here is a screenshot of it after I rotate a few times: enter image description here

Here is a screenshot before the rotation (looks great): enter image description here

I have tried to force it to re layout with setNeedsLayout, but no luck.

Any clue???


Solution

  • Try setting self.automaticallyAdjustsScrollViewInsets = NO; in viewDidLoad of ViewController. This will be YES by default.