zoukankan      html  css  js  c++  java
  • iOS tableview headerView footerView设置背景色

    由于项目列表比较复杂,将部分列表的内容用tableView展示并作为一个cell放在父容器的tableView中,通过提前计算子tableView的总高度然后刷新大的tableView的列表,功能是完成了,但是tableView plain模式下,headerView和footerView默认有个灰色的背景,发现设置如下并不能生效

    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor clearColor];
    

    最后发现一个简洁的办法设置背景颜色

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{
        view.tintColor = UIColor.clearColor;
    }
    
    - (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section{
        view.tintColor = UIColor.clearColor;
    }
    

    设置虚线的办法

    -(void)layoutSubviews{
        [super layoutSubviews];
        
        [self.layer addSublayer:self.dottedLine];
    }
    
    - (CAShapeLayer *)dottedLine {
        if (_dottedLine) {
            return _dottedLine;
        }
        
        _dottedLine = [CAShapeLayer layer];
        _dottedLine.strokeColor = FONT_COLOR_EEEEEE.CGColor;
        _dottedLine.fillColor = nil;
        
        UIBezierPath* path = [UIBezierPath bezierPath];
        path.lineWidth     = 1.f;
        path.lineCapStyle  = kCGLineCapRound;
        path.lineJoinStyle = kCGLineJoinRound;
        [path moveToPoint:CGPointMake(kRealValue(89), 8)];
        [path addLineToPoint:CGPointMake(kRealValue(89), kRealValue(58) - 8)];
        
        _dottedLine.path = path.CGPath;
        _dottedLine.frame = CGRectMake(0, 0, 1, kRealValue(58) - 8 );
        _dottedLine.lineWidth = 1.f;
        _dottedLine.lineCap = @"square";
        _dottedLine.lineDashPattern = @[@4, @3];
        return _dottedLine;
    }
    
  • 相关阅读:
    Linux LCD驱动(四)--驱动的实现
    Linux LCD驱动(三)--图形显示
    s3c2440的LCD字符显示
    Linux framebuffer显示bmp图片
    Linux Framebuffer编程简介
    linux 2440 LCD 应用程序编程
    嵌入式Linux下S3C2410的调色板彩色显示
    l​i​n​u​x​下​L​C​D​(​f​r​a​m​e​b​u​f​f​e​r​)​驱​动​分​析
    我的基本信息
    unity生命周期
  • 原文地址:https://www.cnblogs.com/qqcc1388/p/14848418.html
Copyright © 2011-2022 走看看