如何使 UITableViewCell 居中,约束无法对齐

How to center UITableViewCell, constraints are not able to align

我无法对齐 UITableViewCell,请看图

出于某种原因,我无法为单元格和 UITableView 对齐约束:

A UITableViewCell 的宽度始终与其 UITableView 相同。所以你不能为单元格设置对齐约束。您看到的是 UITableViewCell 的默认行为。分隔线延伸到右侧。左边有空白。

如果您想要一条两边都有边距的居中分隔线,您必须自己绘制并禁用默认分隔线。