关于tableView分割线设置UIEdgeInsetsMake

2017-01-11  本文已影响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];
   }
}
上一篇 下一篇

猜你喜欢

热点阅读