关于UITableView和cell的自定义和技巧
来源:互联网 发布:域名服务器 编辑:程序博客网 时间:2024/06/06 11:44
// 返回cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
}
cell.accessoryType = UITableViewCellAccessory
@property(nonatomic) UITableViewCellAccessory
@property(nonatomic,retain) UIView
@property(nonatomic) UITableViewCellAccessory
@property(nonatomic,retain) UIView
- (void) performExpand:(id)paramSender{
}
通过,上面一步,我们为Cell添加了一个自定义的按钮。
也许就会遇到这么一个纠结的情况,当点击UITableViewCell高亮时,其子视图中不该高亮的对象(比如说自定义的那个按钮)也高亮了。
比如:
正确方式:我们需要cell被选中时,按钮不应该也被高亮显示。如:
错误方式:但是,cell被选中时,按钮却也高亮显示了。如:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
}
因为当UITableViewCell为选中状态时,UITableViewCell把selectedBackgroundView当作一个子视图来添加;
selectedBackgroundView被添加在UITableViewCell的backgroundView之上,或者所有其它视图之下。
当调用setSelected: animated:这一方法时,会导致selectedBackgroundView以一个alpha消化的状态来出现和消失。
还应该注意:
UITableViewCell的selectionStyle值为UITableViewCellSelection
// 设置背景
[self setBackgroundImageByName
[self setBackgroundImage:[UIImage imageNamed:@"table_live_bg.png"]];
[self.contentView insertSubview:messageBackgroundViewbelowSubview:self.textLabel];
//定制Delete字符串,添加函数 返回要显示的字符串
-(NSString *)tableView:(UITableView*)tableView titleForDeleteConfirmati
}
- 关于UITableView和cell的自定义和技巧
- UItableview一个自定义cell和不同高度的例子
- UITableView 的 自定义cell
- UITableView的自定义cell
- iOS开发总结-UITableView 自定义cell和动态计算cell的高度
- UITableView和UICollectionView的cell重用问题
- UITableView刷新指定的section和cell
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- 关于UITableView的Cell复用
- 关于UITableView的Cell复用
- UITableViewCell - UITableView中cell的边框和背景
- UITableViewCell - UITableView中cell的边框和背景 .
- UITableViewCell - UITableView中cell的边框和背景
- UITableViewCell - UITableView中cell的边框和背景
- UITableView Cell Index和数据库的匹配套用
- UITableViewCell - UITableView中cell的边框和背景
- UITableView cell上的button和label问题
- 代码整洁之道的学习与整理
- CCF-工资计算
- java学习笔记___JDK___JRE___JVM区别___配置环境变量
- 地图涂色问题
- 什么是数字签名-超经典
- 关于UITableView和cell的自定义和技巧
- 冒泡排序和选择排序以及两个变量交换
- welcome to flysun2016
- 欢迎使用CSDN-markdown编辑器
- 学习Unity的相关资料
- SpringBoot常用配置介绍
- 牛腩新闻系统发布
- IDEA2016配置运行基于Maven的Git项目
- asp.net core开源组件练习