解决 UITableView的分割线短一截

-(void)viewDidLayoutSubviews
{
    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
    }
    if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [self.tableView 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];
    }
} 
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 需要实现下面的两个方法
    xing_xing阅读 858评论 0 0
  • - (void)viewDidLayoutSubviews { if ([self.tableView respo...
    哆啦_阅读 1,833评论 0 2
  • 1 核心流程 1-0 收材料 需要学生发送有他们确认的相关材料,主要是面试用,在筛选阶段反倒是不是很强烈。 hr收...
    做个好学生阅读 2,607评论 0 0
  • 周末,清晨,一顿丰盛的早餐过后,老公满足地抹了抹嘴巴,兴致盎然,出发,春游去,目的地——廖沟河。 天气晴朗,但阳光...
    像雾像雨像风阅读 2,682评论 0 0
  • 想看热闹的先淡定点,容我细细道来。 其实呢,我会点读心术,但得走着才能读。当我的步调也就是步幅和步速跟另外一个人完...
    萤木C阅读 5,726评论 1 7