您的位置:首页 > 移动开发 > Swift

IOS tableview 消除 分割线短 15 像素 ios8方法 swift版

2015-07-12 23:02 417 查看

系统默认样式:



 

ios8 去除默认分割线边距的代码:

//去除表格左侧分割线代码开始
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
//ios8
if cell.respondsToSelector("setSeparatorInset:"){
cell.separatorInset = UIEdgeInsetsZero
tableView.separatorInset = UIEdgeInsetsZero
//cell.separatorInset.left = 5
}

if cell.respondsToSelector("setLayoutMargins:"){
cell.layoutMargins = UIEdgeInsetsZero
tableView.layoutMargins = UIEdgeInsetsZero
//cell.separatorInset.left = 5
}
}
//
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: