Search code examples
uitableviewswift3uiimageviewautolayoutxcode8

Table view not showing correctly


I am trying to fix this for long time :(
It is an imageView in the table view
There is no error, there is no Autolayout missing.
But the Content View on the left side is showing in Yellow

Table view


Solution

  • You can write this:

    in viewDidLoad():

    self.automaticallyAdjustsScrollViewInsets = false
    

    OR

    tableView.contentInset = UIEdgeInsets.zero
    

    OR

    self.tableView.contentInset = UIEdgeInsetsMake(-65, 0, 0, 0)
    

    OR

    In InterfaceBuilder:

    1. Select the view controller
    2. Open Attributes inspector
    3. There's a property called "Adjust scroll view insets" in IB's attribute inspector (when a view controller is selected) which is on by default.