在viewdidload中
if tableview!.respondsToSelector("setSeparatorInset:"){
tableview?.separatorInset = UIEdgeInsetsZero
}
if tableview!.respondsToSelector("setLayoutMargins:"){
tableview?.layoutMargins = UIEdgeInsetsZero
}
重写
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if cell.respondsToSelector("setLayoutMargins:"){
cell.layoutMargins = UIEdgeInsetsZero
}
if cell.respondsToSelector("setSeparatorInset:"){
cell.separatorInset = UIEdgeInsetsZero
}
}