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

系统默认样式:

q 

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
        }
    }
    //

posted on 2015-07-12 23:02  佟言无忌  阅读(483)  评论(0编辑  收藏  举报