Search code examples
swiftuitableviewautolayoutuistackview

uitableview fill equally does not work in simulator


I have searched couple of days to solve my fill equally problem but I could not find any solution. I added all screenshot for obtained both using stack view and equal widths. Everything looks perfect on the storyboard but when i run it. It looks like enter image description here

Equal widths:

enter image description here

Stack view fill equally:

enter image description here

All custom class identifiers are used properly.

I will appreciate for providing solution to this problem.


Solution

  • As per the comments...

    The issue was that the class for the Content View had been set to the custom UITableViewCell class. Only the prototype cell itself should be set to that class... the Content View should remain at its default UIView.

    It's actually a common mistake.