iOS7 和 iOS8 中tableview cell分割线左对齐的方法不同,特此为之后须要作笔记。blog
iOS7 中方法很简单,只须要设置 _table.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);table
而iOS8 中方法须要写一段代码:class
-(void)viewDidLayoutSubviews { if ([_table respondsToSelector:@selector(setSeparatorInset:)]) { [_table setSeparatorInset:UIEdgeInsetsZero]; } if ([_table respondsToSelector:@selector(setLayoutMargins:)]) { [_table setLayoutMargins:UIEdgeInsetsZero]; } } -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setSeparatorInset:)]){ [cell setSeparatorInset:UIEdgeInsetsZero]; } }