美文网首页
关于tableView分割线设置UIEdgeInsetsMake

关于tableView分割线设置UIEdgeInsetsMake

作者: 有草木青青 | 来源:发表于2017-01-11 16:06 被阅读38次

在viewDidLoad里加上这两个判断

/**! 此判断主要针对tableView的分割线设置UIEdgeInsetsMake在ios8上无效 **/
   if ([self.editorShippingAddressView.talbeView respondsToSelector:@selector(setSeparatorInset:)]) {
       [self.editorShippingAddressView.talbeView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
   }
   if ([self.editorShippingAddressView.talbeView respondsToSelector:@selector(setLayoutMargins:)]) {
       [self.editorShippingAddressView.talbeView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
   }

然后把下面的代理写一下

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
   if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
       [cell setSeparatorInset:UIEdgeInsetsZero];
   }
   
   if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
       [cell setLayoutMargins:UIEdgeInsetsZero];
   }
}

相关文章

网友评论

      本文标题:关于tableView分割线设置UIEdgeInsetsMake

      本文链接:https://www.haomeiwen.com/subject/eijrbttx.html