-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastindexPath!=nil)?[lastindexPath row]:-1;
if (newRow != oldRow) {
myTableViewCell *newcell=(myTableViewCell *)[m_tabview cellForRowAtIndexPath:indexPath];
[newcell setrightHidden:YES];
myTableViewCell *oldcell=(myTableViewCell*)[m_tabview cellForRowAtIndexPath:lastindexPath];
[oldcell setrightHidden:NO];
lastindexPath =indexPath;
}
}
本文介绍了一个UITableView中处理UITableViewCell选中状态变化的方法。通过在tableView:didSelectRowAtIndexPath:方法中更新新旧单元格的视觉效果,实现了当用户点击不同单元格时,当前选中单元格的rightHidden属性能够正确切换,确保了良好的用户体验。
482

被折叠的 条评论
为什么被折叠?



