here is how i am managing this
1. you need an NSMutableArray
the NSMutablearray is the same count as the datasource array for the table
so, you need to populate it with something like this
Code:
self.cellAccessArray = [[NSMutableArray alloc] initWithObjects:@"closed",@"closed",@"closed",@"closed",nil];
[self.cellAccessArray release];
this means we have 4 table rows
now, in your heightForRowAtIndexPath, put this
Code:
if([[self.cellAccessArray object atIndex:indexPath.row] isEqualToString:@"open"])
{
return 140;
}
return 70;
now, to the didSelectRowAtIndexPath
put this
Code:
if([[self.cellAccessArray objectAtIndex:indexPath.row] isEqualToString:@"closed"])
{
[self.cellAccesArray replaceObjectAtIndex:indexPath.row withObject:@"open"];
}
else
{
[self.cellAccesArray replaceObjectAtIndex:indexPath.row withObject:@"closed"];
}
[tableView reloadRowsAtIndexPath:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
1. you need an NSMutableArray
the NSMutablearray is the same count as the datasource array for the table
so, you need to populate it with something like this
Code:
self.cellAccessArray = [[NSMutableArray alloc] initWithObjects:@"closed",@"closed",@"closed",@"closed",nil];
[self.cellAccessArray release];
this means we have 4 table rows
now, in your heightForRowAtIndexPath, put this
Code:
if([[self.cellAccessArray object atIndex:indexPath.row] isEqualToString:@"open"])
{
return 140;
}
return 70;
now, to the didSelectRowAtIndexPath
put this
Code:
if([[self.cellAccessArray objectAtIndex:indexPath.row] isEqualToString:@"closed"])
{
[self.cellAccesArray replaceObjectAtIndex:indexPath.row withObject:@"open"];
}
else
{
[self.cellAccesArray replaceObjectAtIndex:indexPath.row withObject:@"closed"];
}
[tableView reloadRowsAtIndexPath:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
If you want a more Attractive way to do this then click here.