【Swift】Swift中tableviewcell分割线显示不全解决方案

这些小问题得记录一下,方便后面查找,直接上代码:

overridefuncviewDidLoad() {

super.viewDidLoad()

self.view.backgroundColor = UIColor.white

if(homeTabble?.responds(to:#selector(setter: UITableViewCell.separatorInset)))! {

homeTabble?.separatorInset = UIEdgeInsets.zero

}

if(homeTabble?.responds(to:#selector(setter: UIView.layoutMargins)))! {

homeTabble?.layoutMargins = UIEdgeInsets.zero

}

}

代理方法中

functableView(_tableView:UITableView, willDisplay cell:UITableViewCell, forRowAt indexPath:IndexPath) {

ifcell.responds(to:#selector(setter: UIView.layoutMargins)) {

cell.layoutMargins = UIEdgeInsets.zero

}

ifcell.responds(to:#selector(setter: UITableViewCell.separatorInset)) {

cell.separatorInset = UIEdgeInsets.zero

}

}

你可能感兴趣的:(【Swift】Swift中tableviewcell分割线显示不全解决方案)