繁体   English   中英

如何在Swift 3.0中将TableView单元格分隔符设置为100%宽度?

[英]How to set tableview cell separator to 100% width in Swift 3.0?

我正在开发我的第一个应用程序,并且一切正常,但是我发现iPad上的显示问题,即单元格分隔符的宽度受到限制(请参见屏幕截图)

iPad上的屏幕截图

屏幕截图

我已经尝试了所有关于如何将边距设置为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
}

我没有使用情节提要,而是通过编程方式进行的,

任何想法,将不胜感激,

谢谢

我相信这是由“ Readable Content Guide引起的。 您可以通过设置tableView.cellLayoutMarginsFollowReadableWidth = false来禁用它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM