Cells in 2nd UITableView are been padded at top

2019-09-19 08:16发布

问题:

I have two table views side by side in the same view controller, they are both within their own view.

The second one on the right is been padded where as the left hand one is correct.

I have deleted the second one and copied the first to ensure every settings is 100% identical but still cannot remove the padding so that the cells line up horizontally.

Below is a screen shot showing my Storyboard, simular and Xcode view heirarchy, could someone please let me know where this is going wrong.

回答1:

This might be occurring because the UIView containing that UITableView is the topmost view in the controller's main view. This Person solved a seemingly similar issue by adding a garbage transparent view above the table to prevent the insets from automatically pushing the cells down.

If that doesn't work for you, there are many possible solutions here.

EDIT: An excellent experiment would be to see if putting that left hand table view above the right hand table view causes the tables to swap the padding.



回答2:

Hi followed similar steps and did not get this issue so you might be making some kind of mistake you can see this in picture below..

Check for your section once again.