关于tableView分割线设置UIEdgeInsetsMake在ios8上无效

在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];
   }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,791评论 25 709
  • Step 1: 拍照或者从相册里选择图片 首先 要import UIImagePickerControllerDe...
    DF_阅读 4,728评论 0 1
  • 师北宸老师简介: 正阳新媒体首席内容官,曾任凤凰科技主编、LinkedIn中国公关经理、腾讯大家等媒体科技专栏作家...
    Ivysnow阅读 3,987评论 0 1
  • 今年的夏天感觉特别热,连续多日的高温丝毫未见退却迹象,令人炙热难耐。 大街上行人稀少,被太阳烘烤的汽车在城市街道上...
    老范知事阅读 3,214评论 1 2