这些小问题得记录一下,方便后面查找,直接上代码:
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
}
}