zoukankan      html  css  js  c++  java
  • iOS tableViewCell plane格式下,接近section边缘不显示分割线却被复用解决办法 分类: ios技术 2015-06-12 16:19 136人阅读 评论(0) 收藏

        今天做公司产品的时候遇到了如题问题,困扰我很长时间,用尽各种办法不能解决,究其原因不知为何,自定义cell低端有view划线的时候,划线一般的显示1像素,而贴着section的显示很少 顶多0.3像素,这个问题很头疼,后来 想到了一个非常好的办法解决:

     UIImageView *separatorLine = [[UIImageViewalloc]initWithFrame:CGRectMake(20.0f*SizeScaleX,30*SizeScaleY -1.0f, cell.frame.size.width,1.0f)];

            separatorLine.image = [[UIImageimageNamed:@"所有背景.png"]stretchableImageWithLeftCapWidth:1topCapHeight:0];

            separatorLine.tag =5554;

            

            [cell.contentViewaddSubview:separatorLine];

    再做判断

     if(indexPath.row == arr.count-1){

            UIImageView *separatorLine = (UIImageView *)[cellviewWithTag:5554];

            separatorLine.hidden =YES;

        }else{

            UIImageView *separatorLine = (UIImageView *)[cellviewWithTag:5554];


            separatorLine.hidden =NO;


        }


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    【关键字】
    【选择结构语句:switch】
    【数据类型】
    【接口】
    【抽象类和接口的区别】
    【访问权限】
    【内部类】
    【方法】
    【this 关键字】
    【Static】
  • 原文地址:https://www.cnblogs.com/liuqixu/p/4683966.html
Copyright © 2011-2022 走看看