调整分界线距离左边SCREEN_W*35/750.0,0 距离右边SCREEN_W*35/750.0,0
-(void)viewDidLayoutSubviews {
if([self.table respondsToSelector:@selector(setSeparatorInset:)]){
[self.table setSeparatorInset:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];
}
if([self.table respondsToSelector:@selector(setLayoutMargins:)]) {
[self.table setLayoutMargins:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{
if([cell respondsToSelector:@selector(setLayoutMargins:)]){
[cell setLayoutMargins:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];
}
if([cell respondsToSelector:@selector(setSeparatorInset:)]){
[cell setSeparatorInset:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];
}
}
cell.separatorInset = UIEdgeInsetsMake(0,ViewWidth,0,0);// ViewWidth 去掉某一行的分隔线
table.separatorStyle = UITableViewCellSeparatorStyleNone; //分隔线去不去掉
网友评论