UITableViewCell 自定义默认选中 和 改变cell背景图片
来源:互联网 发布:51单片机串口程序 编辑:程序博客网 时间:2024/04/27 22:14
首先我们要改变cell 的nomoral背景和selected 背景:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; static NSString *CellIdentifier = @"Cell33"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; // cell.selectionStyle= UITableViewCellSelectionStyleNone; // cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator; } cell.textLabel.text=[self.cityListArray objectAtIndex:row]; cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_select_normal.png"]]autorelease]; cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_select_highlight.png"]]autorelease]; return cell;}
UITableview我们可以自定义任意一个cell为默认选中状态方法是:
- (void)viewDidAppear:(BOOL)animated { NSIndexPath *indexPath=[NSIndexPath indexPathForRow:0 inSection:0]; [myTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionBottom];}或者
- (void)viewDidLoad { [super viewDidLoad]; NSIndexPath *indexpath=[NSIndexPath indexPathForRow:0 inSection:0]; [myTableView selectRowAtIndexPath:indexpath animated:YES scrollPosition:UITableViewScrollPositionBottom];}效果如图:
默认选中
改变选中的cell 的背景
- UITableViewCell 自定义默认选中 和 改变cell背景图片
- 自定义UITableViewCell 的选中背景图片
- iOS UITableViewCell 改变系统选中按钮(UITableViewCellEditControl)的默认图片和位置
- iOS UItableviewCell 自定义选中颜色及默认选中首行
- UITableViewCell自定义UIImageView点击cell UIImageView大小改变
- ios中UITableViewCell选中后的颜色设置和背景图片
- 自定义UITableViewCell选中Subviews(例如UILabel)背景色发生改变
- 自定义UITableViewCell重用cell
- iOS 开发 解决UITableViewcell单选动态改变cell文字和背景颜色的功能,且第一次默认选择第一个cell
- 设置cell默认选中
- 自定义cell背景和选中时颜色
- UITableViewCell 选中时改变高度
- tableview实现cell有间隔,cell加载背景图片和选中图片
- 系统和自定义 UITableViewCell写法、model赋值cell
- UITableViewCell添加自定义view,在cell选中高亮时,view消失,取消高亮时,view又出现
- listview改变选中行背景图片
- listview改变选中行背景图片
- UiTableView 默认选中一个cell
- GB 28181 视频代理网关功能及基本原理一
- 六大开源监测工具 你用过哪个?
- 什么是私有IP
- stasm 对齐关键源码
- 程序员技术练级攻略
- UITableViewCell 自定义默认选中 和 改变cell背景图片
- C++设计模式实现--单例
- Divide Two Integers
- 2013年5月21日 23:20:12
- Android 通信--蓝牙
- 智能指针之 shared_ptr
- SEAndroid概述
- RQNOJ 合唱队形
- SQL 性能调优 笔记