UITableViewCell的使用介绍
来源:互联网 发布:centos7 ssh 端口 编辑:程序博客网 时间:2024/06/05 10:30
一、创建UITableViewCell的几种样式
/*
UITableViewCellStyle
UITableViewCellStyleDefault, //默认风格,自带标题和一个图片视图,图片在左
UITableViewCellStyleValue1, //只有标题和副标题副标题在右边
UITableViewCellStyleValue2, //只有标题和副标题,副标题在左边标题的下边
UITableViewCellStyleSubtitle //自带图片视图和主副标题,主副标题都在左边,副标题在下
*/
二、UITableViewCell常用属性
当被重用的cell将要显示时,会调用这个方法,这个方法最大的用武之地是当你自定义的cell上面有图片时,如果产生了重用,图片可能会错乱(当图片来自异步下载时及其明显),这时我们可以重写这个方法把内容抹掉。
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
@property (nonatomic) BOOL shouldIndentWhileEditing;
设置编辑状态下是否显示缩进
@property (nonatomic) UITableViewCellAccessoryType accessoryType;
@property (nonatomic, retain) UIView *accessoryView;
附件视图
@property (nonatomic) UITableViewCellAccessoryType editingAccessoryType;
cell编辑时的附件视图风格
@property (nonatomic, retain) UIView *editingAccessoryView;
cell编辑时的附件视图
@property (nonatomic) NSInteger indentationLevel;
设置内容区域的缩进级别
@property (nonatomic) CGFloat indentationWidth;
设置每个级别的缩进宽度
@property (nonatomic) UIEdgeInsets separatorInset;
设置分割线的偏移量
@property (nonatomic, getter=isEditing) BOOL editing;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
设置是否编辑状态
@property(nonatomic, readonly) BOOL showingDeleteConfirmation;
返回是否目前正在显示删除按钮
- (void)willTransitionToState:(UITableViewCellStateMask)state;
cell状态将要转换时调用的函数,可以在子类中重写
- (void)didTransitionToState:(UITableViewCellStateMask)state;
注意:下面这些方法已经全部在IOS3.0后被废弃了,虽然还有效果,但是会被警告
@property (nonatomic, copy) NSString *text;
设置标题
@property (nonatomic, retain) UIFont *font;
设置字体
@property (nonatomic) NSTextAlignment textAlignment;
设置对其模式
@property (nonatomic) NSLineBreakMode lineBreakMode;
设置断行模式
@property (nonatomic, retain) UIColor *textColor;
设置字体颜色
@property (nonatomic, retain) UIColor *selectedTextColor;
设置选中状态下的字体颜色
@property (nonatomic, retain) UIImage *image;
设置图片
@property (nonatomic, retain) UIImage *selectedImage;
设置选中状态时的图片
@property (nonatomic) BOOL hidesAccessoryWhenEditing;
- UITableViewCell的使用介绍
- UITableView使用<2>UITableViewCell的介绍
- IOS UITableViewCell的使用
- UITableViewCell的基本使用
- UITableViewCell?的 使用
- UITableViewCell的简单使用
- 使用UITableViewCell的自定义子类
- UITableView与UITableViewCell的使用
- UITableViewCell的使用和属性
- 使用UITableViewCell遇到的问题
- UITableViewCell中KVO的使用
- UITableView和UITableViewCell的详细介绍
- UITableViewCell使用
- 两种使用自定义UITableViewCell的方法
- 沉痛的教训,UITableViewCell使用总结
- UITableViewCell使用Autolayout布局的解决过程
- UITableViewCell 使用系统的多选
- 使用UITableViewCell子类是出现的问题
- Android 获取ROOT权限原理解析
- 20160325系统集成管理工程师(test2)
- 八大排序算法之直接插入排序
- Android屏幕自适应4种解决方案
- Fastsocket
- UITableViewCell的使用介绍
- Mybatis框架学习笔记一
- 数据结构(19)栈典型问题之C++实现表达式求值
- 安装了PC蓝牙驱动程序后,使用串口助手,出现蓝屏现象!
- 用VM安装Ubuntu,启动后黑屏的解决办法
- git 添加文件到git仓库
- [leetcode ] Factor Combinations -------------因数组合
- c/c++ strrchr函数用法
- 欢迎使用CSDN-markdown编辑器