總結(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];
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ?}
? ? ?} ??
}