我有一个UITableView
其中分隔符没有完整宽度。它在左侧之前 10 个像素处结束。我正在玩这个代码viewDidLoad()
.
self.tableView.layoutMargins = UIEdgeInsetsZero;
同样在情节提要中,您可以选择自定义或默认选择器。现在,所有填充的单元格都没有全宽选择器,但空的单元格具有全宽。
我怎样才能解决这个问题?
这对我在使用 Xcode 6.4 和 Swift 1.2 的 iOS 8.4 - 9.0 设备上有效:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = UITableViewCell()
cell.preservesSuperviewLayoutMargins = false
cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero
return cell
}
斯威夫特 5 更新:
cell.preservesSuperviewLayoutMargins = false
cell.separatorInset = UIEdgeInsets.zero
cell.layoutMargins = UIEdgeInsets.zero
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)