UITableView使用<2>UITableViewCell的介绍
2015-09-10 21:25
387 查看
UITableViewCell
属性:
@property (nonatomic, readonly, retain) UIImageView *imageView ;
@property (nonatomic, readonly, retain) UILabel *textLabel;
@property (nonatomic, readonly, retain) UILabel *detailTextLabel;
@property (nonatomic, readonly, retain) UIView *contentView;
@property (nonatomic, retain) UIView *backgroundView;
@property (nonatomic) UITableViewCellAccessoryType accessoryType;
@property (nonatomic) UITableViewCellAccessoryType editingAccessoryType;
方法:
(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
讲解:
UITableViewCell有个属性是
// If you want to customize cells by simply adding additional views, you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode.
我们可以通过在Cell的contentView上添加自定义的控件来定制UITableViewCell
代码:
属性:
@property (nonatomic, readonly, retain) UIImageView *imageView ;
@property (nonatomic, readonly, retain) UILabel *textLabel;
@property (nonatomic, readonly, retain) UILabel *detailTextLabel;
@property (nonatomic, readonly, retain) UIView *contentView;
@property (nonatomic, retain) UIView *backgroundView;
@property (nonatomic) UITableViewCellAccessoryType accessoryType;
@property (nonatomic) UITableViewCellAccessoryType editingAccessoryType;
方法:
(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
讲解:
UITableViewCell有个属性是
UIView *contentView,官方是这样介绍的:
// If you want to customize cells by simply adding additional views, you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode.
我们可以通过在Cell的contentView上添加自定义的控件来定制UITableViewCell
代码:
UIButton *photographButton = [UIButton buttonWithType:UIButtonTypeCustom]; photographButton.frame = CGRectMake(221 , 10, 100, 44); [photographButton setImage:[UIImage imageNamed:@"camera.png"] forState:UIControlStateNormal]; [photographButton addTarget:self action:@selector(photographButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; [cell.contentView addSubview:photographButton];
相关文章推荐
- UIButton
- COCI CONTEST #3 29.11.2014 T3 SILUETA
- UIlabel
- NGUI使用图集的精灵换图片
- IOS-UI-视图控件UIview
- iOS:集合视图UICollectionView、集合视图控制器UICollectionViewController、集合视图单元格UICollectionViewCell(创建表格的另一种控件)
- CodeForces 11A - Increasing Sequence
- Illegal instant due to time zone offset transition (Asia/Shanghai)
- HDU4620 Fruit Ninja Extreme(搜索+剪枝)
- HotSpot Builder Utility安装指南
- 用UITextView加载rtfd文件
- Android UI 优化方向
- UITableView 基础知识
- String,StringBuffer和StringBuilder的区别
- MAC上反编译android apk---apktool, dex2jar, jd-jui安装使用(含手动签名)
- HDU_1242_Rescue
- 安卓常见错误处理记录5:安卓系统编译报错 finished with non-zero exit value -1073741819
- hdu 5312 Sequence(数学推导+线性探查(两数相加版))
- [leetcode]Word Frequency
- easyui表单验证