一、手动设置
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row==self.dataArray.count-1) {
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
}
/**
* 布局视图
*/
-(void)viewDidLayoutSubviews
{
if ([self.myTableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.myTableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
}
if ([self.myTableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.myTableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
}
}
二、使用第三方ESSeparatorInset分类
UITableView 隐藏最后一条分割线-->footerView高度0.1)
ESSeparatorInset分类一行代码搞定
UIView
UIViewController+ESSeparatorInset.h
UIViewController+ESSeparatorInset.m