swift3.0 tableviewcell分割线显示不全解决方案

来源:互联网 发布:java基础笔试题 编辑:程序博客网 时间:2024/05/12 21:56

在viewDidLoad()添加一下代码

if tableView.responds(to:#selector(setter: UITableViewCell.separatorInset)) {      tableView.separatorInset = UIEdgeInsets.zero}        if tableView.responds(to:#selector(setter: UIView.layoutMargins)) {      tableView.layoutMargins = UIEdgeInsets.zero}

tableview实现多以下代理

    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {        if cell.responds(to:#selector(setter: UIView.layoutMargins)) {            cell.layoutMargins = UIEdgeInsets.zero        }        if cell.responds(to: #selector(setter: UITableViewCell.separatorInset)) {            cell.separatorInset = UIEdgeInsets.zero        }    }
0 0
原创粉丝点击