iOS UITableView 设置默认选中行及其颜色
来源:互联网 发布:小米抢购软件app 编辑:程序博客网 时间:2024/06/05 03:39
//在创建UITableView或获取数据的地方设置默认选中一行,这里默认选中第一行
[self.tableViewselectRowAtIndexPath:[NSIndexPathindexPathForItem:0inSection:0]animated:YESscrollPosition:UITableViewScrollPositionTop];
if ([self.tableView.delegaterespondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]) {
[self.tableView.delegatetableView:self.tableViewdidSelectRowAtIndexPath:[NSIndexPathindexPathForItem:0inSection:0]];
}
//设置选中颜色是在以下执行的
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
staticNSString * cellId =@"SortTableViewCell";
UITableViewCell * cell = [tableViewdequeueReusableCellWithIdentifier:cellId];
if (cell ==nil) {
cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellId];
}
cell.selectedBackgroundView = [[UIViewalloc] initWithFrame:cell.frame];
cell.selectedBackgroundView.backgroundColor =[UIColorwhiteColor];
return cell;
}
- iOS UITableView 设置默认选中行及其颜色
- ios 设置UITableView 选中行cell的背景颜色(自定义选中的背景颜色)
- iOS UITableView 和 UICollectionView 设置默认选中状态
- ios tableView设置cell选中颜色以及表格默认选中某行
- ios UITableView separatorColor 默认颜色
- 设置cell选中颜色以及表格默认选中某行
- 设置cell选中颜色以及表格默认选中某行
- iOS中 cell的选中颜色以及默认选中行
- iOS UItableviewCell 自定义选中颜色及默认选中首行
- 设置UITableView中单元格的默认选中
- iOS 设置UITabBar,背景颜色,默认图片,文字颜色,和选中颜色.
- XtraGrid GridView设置默认选中的行颜色
- wpf datagrid 样式怎么设置默认选中行的颜色
- ios 设置tabbar选中颜色
- UITableView选中时颜色
- IOS开发相关07--UITableView默认选中第一个cell
- iOS UITableViewCell选中后的颜色设置
- Android 动态设置RadioButton选中和没选中的颜色及设置默认选中某一项
- GreenDao
- 百度编译器从数据库获取内容
- flask使用celery定时器
- Android View关系
- 求最大连续bit数-动态规划解法
- iOS UITableView 设置默认选中行及其颜色
- 我与java的第一次邂逅
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual error
- 分别用selenium和scrapy爬取网站(二)
- Nginx的几种负载均衡策略
- leetcode Algorithms 8. String to Integer (atoi)
- 617. Merge Two Binary Trees
- 深度剖析:Java POJO Bean 对象与 Web Form 表单的自动装配
- 顺序表类