-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// 三个方法并用,实现自定义分割线效果
UIEdgeInsets edge = UIEdgeInsetsMake(0, 20, 0, 0);
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:edge];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:edge];
}
if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
[cell setPreservesSuperviewLayoutMargins:NO];
}
}
tableViewCell自定义分割线效果
最新推荐文章于 2019-02-18 11:47:44 发布