zoukankan      html  css  js  c++  java
  • iOS边练边学--UITableViewCell的常见属性设置

     1 // 取消选中的样式(常用) 让当前 cell 按下无反应
     2 cell.selectionStyle = UITableViewCellSelectionStyleNone;
     3 
     4 // 设置选中的背景色,UIView无需设置UIView的尺寸
     5 UIView *selectedBackgroundView = [[UIView alloc] init];
     6 selectedBackgroundView.backgroundColor = [UIColor redColor];
     7 cell.selectedBackgroundView = selectedBackgroundView;
     8 
     9 // 设置默认的背景色,优先级低
    10 cell.backgroundColor = [UIColor blueColor];
    11 
    12 // 设置默认的背景色,优先级高
    13 UIView *backgroundView = [[UIView alloc] init];
    14 backgroundView.backgroundColor = [UIColor greenColor];
    15 cell.backgroundView = backgroundView;
    16 
    17 // backgroundView的优先级 > backgroundColor
    18 // 设置指示器,系统默认的几个选项
    19 // cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    20 // 也可以自己设置指示器,这里讲指示器做成了开关
    21 cell.accessoryView = [[UISwitch alloc] init];
  • 相关阅读:
    sublime使用技巧
    周末时间学习Linux
    中小企业网络安全提升
    NoSQL是什么?
    IBM的淘汰之路
    Linux 中断处理浅析
    深入理解 C 语言的函数调用过程
    LAMP简易安装
    安装Fedora 24后必要的设置
    wget命令详解
  • 原文地址:https://www.cnblogs.com/gchlcc/p/5279763.html
Copyright © 2011-2022 走看看