zoukankan      html  css  js  c++  java
  • tableViewCell的分割线短一截的问题

    最近在写很简单的tableView的布局时,发现系统自带的Cell分割线短了15像素,不过这个可以更改,纯代码方式如下:

     //设置分割线到头,不再断15像素

        if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {

            

            [self.tableView setLayoutMargins:UIEdgeInsetsZero];

            

        }

     在ios7系统运行上面的就可以搞定,不过ios8 必须加上下面的方法和内容,否则依然短15像素

    - (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];

            

        }

        

    }

    原文出处:http://blog.csdn.net/lengshengren/article/details/19335637,向作者致敬! 

  • 相关阅读:
    【转】教你爱上Blocks(闭包)
    【转】iOS Developer:真机测试
    bzoj1231 混乱的奶牛
    bzoj2064 分裂
    洛谷P2051 中国象棋
    洛谷P2607 骑士
    洛谷P1879 玉米田
    洛谷P3694 邦邦的大合唱
    openjudge dp水题记录
    bzoj1191 超级英雄
  • 原文地址:https://www.cnblogs.com/daaiwusehng/p/4762489.html
Copyright © 2011-2022 走看看