UITableView 样式的自定义
来源:互联网 发布:人工智能自然语言处理 编辑:程序博客网 时间:2024/06/05 10:09
// 返回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:[UIImageimageNamed:@"table_live_bg.png"]];
[self.contentView insertSubview:messageBackgroundViewbelowSubview:self.textLabel];
//定制Delete字符串,添加函数返回要显示的字符串
-(NSString*)tableView:(UITableView*)tableViewtitleForDeleteConfirmati
}
- UITableView样式的自定义
- UITableView 样式的自定义
- UITableView样式的自定义
- UITableView-的cell 自定义 高度,样式
- 自定义UITableView的左滑动样式
- UITableView 应用(五)UITableView样式的自定义
- [转载]UITableView 应用(五)UITableView样式的自定义
- 自定义UITableView的Section的title的样式
- 自定义UITableView的Section的title的样式
- UITableView普通的样式
- 自定义UITableView的Header
- UITableView 的 自定义cell
- UITableView的自定义cell
- [iOS UItableView 自定义Section] 自定义Section 修改title样式
- UITableView样式
- iOS8使用UITableViewRowAction自定义UITableView左划样式
- UITableView的Group样式的详细使用
- iOS Uitableview的cell的选中样式
- Android性能优化典范
- FFmpeg 音频解码:应用buffer缓冲机制
- 将Ext JS 5应用程序导入Web项目中
- linux read/write和fread/fwrite有什么区别
- <span> 无法设置宽度的完美解决方案!
- UITableView 样式的自定义
- php输出时间差
- oracle的TM锁、TX锁
- Android自定义组件系列【4】——自定义ViewGroup实现双侧滑动
- (function ($, undefined){ })(jQuery); 的使用及说明
- Android MVC 结构
- GitHub项目Storm-HBase介绍
- 如何在Xcode平台上安装并创建新的cocos2d-x项目
- ArcGIS教程:选择步长大小