Search code examples
iosobjective-cuitableviewuiviewcontrollerautoresize

TableView in UIViewController moves to sides inside the window


I've just put a TableView inside a UIViewController and embedded ViewController in NavigationController via the storyboard. I implemented delegate & source methods and everything works fine except when I load the view in landscape mode for the first time and then change it to portrait mode. TableView could be moveable to the sides outside of the window and it stays, but it is not sticking to edges.

Screenshot of the issue described above.

PS: This is designed for use on iPad.

edit: added another ss : http://d.pr/i/vs5d


Solution

  • found the answer; need to reload the tableview after orientation change. I guess it's an auto layout bug that happens after landscape->portrait orientation change.

    -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        [self.tableView beginUpdates];
        [self.tableView endUpdates];
    }