swift问题汇总

【Swift】Swift中tableviewcell分割线显示不

2017-08-28  本文已影响30人  简单的美利坚

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

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

}

}

上一篇 下一篇

猜你喜欢

热点阅读