zoukankan      html  css  js  c++  java
  • UITableViewCell的分割线顶头

    第一步:

    -(void)viewDidLayoutSubviews {

        if ([_leftTableView respondsToSelector:@selector(setSeparatorInset:)]) {

            [_leftTableView setSeparatorInset:UIEdgeInsetsZero];

        }

        if ([_leftTableView respondsToSelector:@selector(setLayoutMargins:)])  {

            [_leftTableView setLayoutMargins:UIEdgeInsetsZero];

        }

    }

    第二步:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

    {

              if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {

                [cell setLayoutMargins:UIEdgeInsetsZero];

            }

            if ([cell respondsToSelector:@selector(setSeparatorInset:)]){

                [cell setSeparatorInset:UIEdgeInsetsZero];

            }

     }

    或者

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

        }

     }

  • 相关阅读:
    Python 中的一些小技巧
    Java/Python/Elixir 正则库使用上的注意事项
    Scrapy 学习笔记(一)数据提取
    记第一次面试
    Spring Web MVC 笔记
    Java 单元测试
    Spring 笔记(四)AOP
    C 语言 进阶
    编程的智慧
    Spring 笔记(三)Bean 装配
  • 原文地址:https://www.cnblogs.com/KLNL100/p/4828002.html
Copyright © 2011-2022 走看看