I am making an application that requires the expansion of onclick cells to show more details. I used a custom cell and added them to a UItableview. When I click on a cell, it animates the beautiful and goes down, and when I click again, it goes up, this is done using a change in the height of the cell. The actual size of user cells is larger than I usually show. When I click on a cell, the whole cell is displayed. Only problem I am facing is data overflow. this data should be hidden if the cell is not selected. Only when it is selected, data should be displayed.
I mentioned different articles, trying to change the binding of color settings, did not work for me. I have the same problem that the uitablecellview iphone overflow asked in this question, tried to answer, but that didn't work.
All I need to do is hide the bottom of the user cell when it is not expanded, and show it when it is expanded ...!
These are my screenshots.
When it is loaded
When I click on the cell]
When I click on the second cell 
When I click on a cell that is already expanded These are the codes I used ....
// Declaring the SearchResultTable. CGRect filterFrame = CGRectMake(0,31, 320, 400); self.searchResultTable = [[UITableView alloc] initWithFrame:filterFrame]; self.searchResultTable.dataSource = self; self.searchResultTable.delegate = self; self.searchResultTable.backgroundColor = [UIColor whiteColor]; self.searchResultTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine; self.searchResultTable.separatorColor = [UIColor lightGrayColor]; [self.view addSubview:self.searchResultTable]; //Adding cells - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ExpandedSearchResultTableCell"; ExpandedSearchResultTableCell *cell = (ExpandedSearchResultTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell.contentView.clipsToBounds = YES; NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ExpandedSearchResultTableCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } cell.productNameLable.text = @"Only this should be shown"; cell.productListLabel.text = @"This Should be hidden.. Only shown when expanded"; cell.productApplicationLable.text=@ "This Should be hidden.. Only shown when expanded"; cell.productTargetLable.text= @"This Should be hidden.. Only shown when expanded"; cell.productQuantityLable.text=@ "This Should be hidden.. Only shown when expanded"; cell.productReactivityLable.text=@ "This Should be hidden.. Only shown when expanded";; return cell; } //on click event (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Deselect cell [tableView deselectRowAtIndexPath:indexPath animated:TRUE]; // Toggle 'selected' state BOOL isSelected = ![self cellIsSelected:indexPath]; // Store cell 'selected' state keyed on indexPath NSNumber *selectedIndex = [NSNumber numberWithBool:isSelected]; [selectedIndexes setObject:selectedIndex forKey:indexPath]; // This is where magic happens... [searchResultTable beginUpdates]; [searchResultTable endUpdates]; } //Getting the height depending on expanded or not - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // If our cell is selected, return double height if([self cellIsSelected:indexPath]) { return kCellHeight * 3.0; } // Cell isn't selected so return single height return kCellHeight; }
Gihan source share