UITableViewCell 四种样式的具体显示效果&&获取可见UITableView 中的所有cell

UITableViewCell 得样式说明:


typedef NS_ENUM(NSInteger, UITableViewCellStyle) {

    UITableViewCellStyleDefault,// Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x)

    UITableViewCellStyleValue1,// Left aligned label on left and right aligned label on right with blue text (Used in Settings)

    UITableViewCellStyleValue2,// Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts)

    UITableViewCellStyleSubtitle// Left aligned label on top and left aligned label on bottom with gray text (Used in iPod).

};             // available in iPhone OS 3.0

 

实测对应关系如下:

1.UITableViewCellStyleDefault:一个左对齐得标题,可选的图片。

 

2.UITableViewCellStyleValue1:图片可选择性添加;左对齐默认格式标题;右对齐浅色副标题。


3.UITableViewCellStyleValue2:标题字体为蓝色,右对齐;副标题左对齐,模认样式。


4.UITableViewCellStyleSubtitle:顶部左对齐标题;底部左对齐副标题,图片可选择性添加。



获取UITableView中的所有可见的cell:

- (NSArray *)visibleCells;


tableView. visibleCells-->返回的是一个当前表视图的所有可见cell。可用于

点击cell时,设置选中cell的accessoryType      等操作。

for (UITableViewCell *cell in [tableView visibleCells]) {

        cell.accessoryType=UITableViewCellAccessoryNone;

    }

 [tableView cellForRowAtIndexPath:indexPath].accessoryType=UITableViewCellAccessoryCheckmark;



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值