Tableview分割线显示
2017-02-21 本文已影响21人
TsingQue
pragma mark - 以下两个方法 是将tableview的分割线 顶头
-
(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if([cell respondsToSelector:@selector(setSeparatorInset:)]){
[cell setSeparatorInset:UIEdgeInsetsMake(0,70,0,10)];
}if([cell respondsToSelector:@selector(setLayoutMargins:)]){
[cell setLayoutMargins:UIEdgeInsetsMake(0,70,0,10)];
}
} -
(void)viewDidLayoutSubviews{
if([_tableView respondsToSelector:@selector(setSeparatorInset:)]){
[_tableView setSeparatorInset:UIEdgeInsetsMake(0,70,0,10)];
}if([_tableView respondsToSelector:@selector(setLayoutMargins:)]){
[_tableView setLayoutMargins:UIEdgeInsetsMake(0,70,0,10)];
}
}