zoukankan      html  css  js  c++  java
  • 解决tableViewCell分割线不到左边界的问题

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    在tableView控制器的.m文件中任何位置加入以下两个方法即可解决
     
    /**
     *  下面两个方法解决cell分割线不到左边界的问题
     */
    -(void)viewDidLayoutSubviews {
         
        if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
            [self.tableView setSeparatorInset:UIEdgeInsetsZero];
             
        }
        if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])  {
            [self.tableView setLayoutMargins:UIEdgeInsetsZero];
        }
         
    }
     
    /**
     * 这个方法和上面一个方法解决cell分割线不到左边界的问题
     */
    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{
        if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
            [cell setLayoutMargins:UIEdgeInsetsZero];
        }
        if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
            [cell setSeparatorInset:UIEdgeInsetsZero];
        }
    }
  • 相关阅读:
    [TC11326]ImpossibleGame
    [CC-FNCS]Chef and Churu
    [JZOJ4786]小a的强迫症
    [USACO08NOV]Time Management
    ARC070F HonestOrUnkind
    LOJ2799 「CCC 2016」生命之环
    Luogu P5824 十二重计数法(小球盒子计数)
    Luogu P4249 [WC2007]剪刀石头布
    Kattis heapsoffun Heaps of Fun
    Kattis xorsequences XOR Sequences
  • 原文地址:https://www.cnblogs.com/bugismyalllife/p/4884270.html
Copyright © 2011-2022 走看看