Search code examples
iosiphoneuitableviewuisplitviewcontroller

Margin on Master View Controller on iPhone only


I have created a Master/Detail app not using the Apple Default's Template but by simply clearing the storyboard and dragging a split view controller to there.

I select the split view controller and configure it like this:

enter image description here

The table view controller cell inside the master has only one image view that is 240x180 points.

This image view is configured to have the Content View width and height and be centered.

When I run this project this is how I see the master view controller

On the iPad

enter image description here

On the iPhone

enter image description here

for some reason on the iPhone version the image is not filling the whole cell and is shifted to the right.

This red band is the color when the cell is selected.


Solution

  • I love how these APIs do not work consistently across devices.

    The same Table View Controller, the same project, shows differently on iPhone and iPad.

    The red rectangle is the selected background view, that I have set to red, so when the cell is selected a red rectangle shows around. The problem is that there is an old iOS bug that makes the selection background view to cover the cell content partially.

    Apparently the bug happens on the iPhone, but not the iPad.

    To solve the problem, turn OFF this Insets To Safe Area on the Size Inspector of the Table View. This is turned on by default when you create the table.

    enter image description here