是否有一种简单的方法可以让UITableView高亮显示哪一行是通过泄露指示器选择给用户的?
如果选择了第3行,那么在选择了第10行之后(一次只能选择一行),那么:
第3行的disappear
发布于 2011-11-03 05:55:33
试试这个,这里的count_of_rows是填充表的数组的计数。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [table cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
int selectedRow = indexPath.row;
for(int i=0 ; i < count_of_rows ; i++)
{
if(i != selectedRow)
{
UITableViewCell * c= [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:1]]
c.accessoryType = UITableViewCellAccessoryNone;
}
}
}发布于 2011-11-03 05:53:16
使用此函数并获取行和列的索引路径。
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *)indexPath
{
// int x = indexPath.row ;
[tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
}https://stackoverflow.com/questions/7990722
复制相似问题