设置cell选中颜色以及表格默认选中某行
2014-11-21 10:06
495 查看
1.在加载cell的地方(即 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath里面)加上下面几句代码
[cell setBackgroundColor:CLEARCOLOR];
cell.selectedBackgroundView = [[UIView
alloc]
initWithFrame:cell.frame];
cell.selectedBackgroundView.backgroundColor =
COLOR(255,
255,
255, 1.0);
2.制定表格默认选中某一行
//设置选中第一行
[self.tableView selectRowAtIndexPath:[NSIndexPath
indexPathForItem:0
inSection:0]
animated:YES
scrollPosition:UITableViewScrollPositionTop];
if ([self.tableView.delegate
respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)])
{
[self.tableView.delegate
tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath
indexPathForItem:0
inSection:0]];
}
*)indexPath里面)加上下面几句代码
[cell setBackgroundColor:CLEARCOLOR];
cell.selectedBackgroundView = [[UIView
alloc]
initWithFrame:cell.frame];
cell.selectedBackgroundView.backgroundColor =
COLOR(255,
255,
255, 1.0);
2.制定表格默认选中某一行
//设置选中第一行
[self.tableView selectRowAtIndexPath:[NSIndexPath
indexPathForItem:0
inSection:0]
animated:YES
scrollPosition:UITableViewScrollPositionTop];
if ([self.tableView.delegate
respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)])
{
[self.tableView.delegate
tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath
indexPathForItem:0
inSection:0]];
}
相关文章推荐
- ios tableView设置cell选中颜色以及表格默认选中某行
- 设置cell选中颜色以及表格默认选中某行
- 表视图默认选中第一个cell以及button外沿特性设置
- iOS中 cell的选中颜色以及默认选中行
- 表视图默认选中第一个cell以及button外沿特性设置
- extjs6 表格行选中时去掉默认背景颜色
- XtraGrid GridView设置默认选中的行颜色
- IOS UITableViewCell的选中时的颜色设置
- (八)yii 使用下拉框设置默认值以及默认选中
- 在Eclipse RCP 设置表格的行高、背景颜色以及字体等等
- ios中UITableViewCell选中后的颜色设置和背景图片
- UITableViewCell的选中时的颜色设置
- UITableViewCell背景色.选中背景色,分割线,字体颜色设置
- 在Eclipse RCP 设置表格的行高、背景颜色以及字体等等
- XtraGrid GridView设置默认选中的行颜色
- QTextEdit中选中文本修改字体与颜色,全部文本修改字体与颜色(设置调色板的前景色、背景色、文字颜色以及基色)
- 设置cell选中后一段时间颜色自动消失
- ios中UITableViewCell选中后的颜色设置
- 1016-06-首页20-封装工具条---UITableView控件距离顶部的间距问题----cell选中时的背景颜色设置
- tableviewcell表视图cell选中时的颜色及背景设置,为什么无效?