zoukankan      html  css  js  c++  java
  • iOS UITableView 分割线从零开始

    第一种(不自己画线):

    代码如下

    // tableView的分割线从零开始
    -(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];
        }
    }

    第二种

    自定义Cell 在Cell中自己画线

    要使用这种方法 把tableView的自带分割线先去掉

    self.table.separatorStyle = UITableViewCellSeparatorStyleNone;

    然后在自定义cell里面

    写一个view在最底部 当作分割线 就好了。

  • 相关阅读:
    Python 函数与函数式编程
    Python 字符编码与转码
    Python 读写txt文件操作
    两阶段事务总结
    MPPDB集群高可用设计
    MPPDB中的各个组件
    IntelliJ IDEA2016学习小结
    mysql免安装版配置
    理想的智能机
    java对象的大小
  • 原文地址:https://www.cnblogs.com/huanying2000/p/6192490.html
Copyright © 2011-2022 走看看