Hi Eddie
My cellForRowAtIndexPath looks like this
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
/*if(is_TableRow_Clicked == FALSE)
{
//create custom label 1
[cell.contentView addSubview:label1];
labelCustomerID.text=@"IDs";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
else {
//create custom label 2
[cell.contentView addSubview:label2];
labelCustomerID.text=@"IDs"; //ID label again
//create custom label 3
[cell.contentView addSubview:label3];
labelCustomerID.text=@"Names";
//create custom label 4
[cell.contentView addSubview:label4];
labelCustomerID.text=@"Addresses";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.clearsContextBeforeDrawing = TRUE;
is_TableRow_Clicked == FALSE;
} */
return cell;
}
all the labels are declared globally and in my didSelectRowAtIndexPath I do this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
is_TableRow_Clicked = TRUE;
selectedCellIndexPath = indexPath;
[label3 removeFromSuperview];
[label4 removeFromSuperview];
[theTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
and finally my heightForRowAtIndexPath looks like this:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// Note: Some operations like calling [tableView cellForRowAtIndexPath:indexPath]
// will call heightForRow and thus create a stack overflow
if(selectedCellIndexPath != nil
&& [selectedCellIndexPath compare:indexPath] == NSOrderedSame)
return 90;
return 50;
}
Hope you can help me on this.