Table view cell expandable iOS
I want a table view with only cels, and when you click on a cell it should expand and show more info of the clicked cell.
I've seen quite some topics on this, but the most of them are linking to Table View Animations and Gestures on the apple developer page. Which does it in a different way. They use header sections, but I want to use the cell which is expandable for layout reasons.
I already tried several things mainly with
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (isSearching && indexPath.row =开发者_如何学Go= selectedIndex) {
return 110;
}
else {
return rowHeight;
}
When I Click on the cell, the cell is expanded but the info in that cell stays the same. Also the heigth of the cell when expanded should be related to the amount of text in the details.
Thnx!
You can achieve this through the use of custom cells. Create two custom cells, one for the normal row and other for the expanded row. When the user touches a particular cell, you can record it's indexPath and reload the tableView. While reloading you can change the height of this selected row using the code that you've just posted(increasing the height of only the selected cell). This would give an effect of expanding cell.
精彩评论