swift tableview的分割线不能到头
1,设置tableview的separatorInset, layoutMargins
if(myTableView.respondsToSelector("setSeparatorInset:")) { myTableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0) } if(myTableView.respondsToSelector("setLayoutMargins:")) { myTableView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0) }
2,设置cell的separatorInset, layoutMargins
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { if(cell.respondsToSelector("setSeparatorInset:")) { cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0) } if(cell.respondsToSelector("setLayoutMargins:")) { cell.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0) } }
- 上一篇 »京东官网
- 下一篇 »css分割线 文字居中的7种实现方式