TableView单元格分隔线不会在整个单元格中延伸

时间:2015-02-22 06:21:52

标签: swift interface-builder xcode6

我正在开发一个新项目,并为UI使用了故事板。我的所有tableView都有行分隔符的问题。下图显示了两行。第一个是在属性检查器中设置的蓝色。第二个是黑色,并添加了我放在单元格中的imageView。该线确实延伸到单元格的右侧,但不是左侧。有什么想法吗?

Blue separator line does not extend all the way to the left side of the cell.

2 个答案:

答案 0 :(得分:4)

首先设置表格视图
1.set separator将tableview实例设置为UIEdgeInsetsMake(0,0,0,0)
第二组细胞
1.set preservesOperviewLayoutMargins of cell(instance)to NO
2.set layoutMobgins of cell to UIEdgeInsetsZero
3.saet separator将单元格设置为UIEdgeInsetsZero

希望能帮到你

答案 1 :(得分:2)

您必须将名为preservesSuperviewLayoutMargins的单元格属性设置为false

cell.preservesSuperviewLayoutMargins = false

他们只需要将单元格layoutMargins设置为零

cell.layoutMargins = UIEdgeInsetsZero

您还需要选择tableView分隔符,选择自定义并将左值从15更改为0

enter image description here

您需要为您的单元格执行相同操作,只需将左侧值从15更改为0:

enter image description here

相关问题