• UITableViewCell


    cell常见的几种附加类型:

    去除点击cell时的高亮效果:

     1     // 去除点击cell时的高亮效果
     2     
     3     // 方式一:
     4     override func setHighlighted(_ highlighted: Bool, animated: Bool) {
     5         // 去除手指按下的高亮效果
     6         super.setHighlighted(false, animated: false)
     7     }
     8     override func setSelected(_ selected: Bool, animated: Bool) {
     9         // 去除手指抬起时的高亮效果
    10         super.setSelected(false, animated: false)
    11     }
    12 
    13     // 方式二:
    14     let cell = yscell(style: .default, reuseIdentifier: "cellID")
    15     // 设置选中样式为none
    16     cell.selectionStyle = .none

    设置cell选中时的背景色:

    1     // 此段代码在自定义cell里面
    2     // 选中时的背景View,可以根据情况加一些子View在上面
    3     UIView *selectBgView = [[UIView alloc] init];
    4     selectBgView.backgroundColor = [UIColor ys_colorWithHex:0xffffff andAlpha:1];
    5     self.selectedBackgroundView = selectBgView;
  • 相关阅读:
    求最低价格
    A*算法入门
    hdu 4715
    手动扩大栈内存,让AC无忧
    hdu 4710
    hdu 1698
    poj3468区间延迟更新模板题
    hdu 1059二进制优化背包问题
    2059龟兔赛跑
    水1276
  • 原文地址:https://www.cnblogs.com/panda1024/p/6306562.html
Copyright © 2020-2023  润新知