BOOL bCheck[20]; (也可以是NSArray,里面添加NSNumber成员,记录cell高度,这里简单用bool数组)
记录每个cell的高度,
然后在:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (bCheck[indexPath.row]) {
return 100;
}else{
扫描二维码关注公众号,回复:
747452 查看本文章
return 50;
}
}
最后处理选择操作:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
bCheck[indexPath.row] = YES;
[tableView reloadData];
bCheck[indexPath.row] = NO;
}
//知更某一行的数据
[tableView reloadRowsAtIndexPaths:[NSArrayarrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
使用这行代码来设置tableView的初始位置:
[tableview setContentOffset:CGPointMake(0,480) animated:YES];