swift设置tableview分割线置顶
2017-07-13 本文已影响0人
羽化行云
override func viewDidLayoutSubviews() {
if(self.tableView?.responds(to: #selector(setter: UITableViewCell.separatorInset)))! {
self.tableView?.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0)
}
if(self.tableView?.responds(to: #selector(setter: UIView.layoutMargins)))! {
self.tableView?.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0)
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if(cell.responds(to: #selector(setter: UITableViewCell.separatorInset))) {
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0)
}
if(cell.responds(to: #selector(setter: UIView.layoutMargins))) {
cell.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0)
}
}