總結(jié)一下梭伐,分割線移除左邊15個(gè)單位長(zhǎng)度的步驟 :
1.separatorInset設(shè)置為UIEdgeInsetsZero旷余,至于是tableview還是tableviewcell祝钢,隨你
2.tableviewcell的layoutMargins設(shè)置為UIEdgeInsetsZero(layoutMargins定義了視圖邊界與子視圖邊界之間間距)
3.確定cell的加載方式窖杀,如果from nib角骤,那么步驟1投蝉、2足矣养葵。如果from code,那么兩種處理方式
? ? ? ? tableviewcell的preservesSuperviewLayoutMargins設(shè)置為NO
? ? ? ? tableview的layoutMargins設(shè)置為UIEdgeInsetsZero
至此瘩缆,媽媽再也不用擔(dān)心我的分割線了关拒。
ps:
//去除cell最后一條分割線
-(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath
{
//處于最后一條分割線
? ? ? if(indexPath.row == ary.count-1) {
? ? ? ? ? ?for(UIView*view in cell.subviews) {
? ? ? ? ? ? ? ? ?if(view.height<=1) {
? ? ? ? ? ? ? ? ? ? ? ?[view removeFromSuperview];
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ?}
? ? ?} ??
}