[英]How to set tableview cell separator to 100% width in Swift 3.0?
I'm developing my first app, and have got everything working except I have discovered a display issue on iPad, where the separator of a cell is limited in width (see screenshot) 我正在开发我的第一个应用程序,并且一切正常,但是我发现iPad上的显示问题,即单元格分隔符的宽度受到限制(请参见屏幕截图)
Screen shot on iPad iPad上的屏幕截图
I've tried everything that I can find on how to set the margins to 0, etc, including: 我已经尝试了所有关于如何将边距设置为0等的方法,包括:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellId", for: indexPath) as! MyCell
myCell.preservesSuperviewLayoutMargins = false
myCell.separatorInset = UIEdgeInsets.zero
myCell.layoutMargins = UIEdgeInsets.zero
return myCell
}
I'm not using storyboard and I am doing it programmatically, 我没有使用情节提要,而是通过编程方式进行的,
Any ideas would be appreciated, 任何想法,将不胜感激,
Thanks 谢谢
I believe it's caused by Readable Content Guide
. 我相信这是由“
Readable Content Guide
引起的。 You can disable it by setting tableView.cellLayoutMarginsFollowReadableWidth = false
您可以通过设置
tableView.cellLayoutMarginsFollowReadableWidth = false
来禁用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.