如何在Swift 3.0中将tableview单元格分隔符设置为100%宽度? [英] How to set tableview cell separator to 100% width in Swift 3.0?

查看:301
本文介绍了如何在Swift 3.0中将tableview单元格分隔符设置为100%宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的第一个应用程序,除了我在iPad上发现了一个显示问题,其中一个单元格的分隔符的宽度有限(见截图)

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上的屏幕截图

我已经尝试了一些我可以找到的关于如何设置边距为0等的结果,
包括:

I've tried everything that I can find on how to set the margins to 0, etc, including:

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,

谢谢

推荐答案

我认为它是由可读内容指南引起的。您可以通过设置 tableView.cellLayoutMarginsFollowReadableWidth = false

I believe it's caused by Readable Content Guide. You can disable it by setting tableView.cellLayoutMarginsFollowReadableWidth = false

这篇关于如何在Swift 3.0中将tableview单元格分隔符设置为100%宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆