I have a UITableview with 2 sections, 1 row in the 1st section and a variable number of rows for the second section. When the user scrolls the table up (moving the finger up), then the table view does this by default, but when the user is at the top of the uitableview and scrolling down (the finger moves down), then it should look like the first cell in the height of the first section increases as much. as the user scrolls down (and releasing the touch changes the height of the line back to its original height of 100). I tried
-(void)scrollViewDidScroll:(UIScrollView*)scrollView{ if(scrollView.contentOffset.y < 0){ [mainTable reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection: 0]] withRowAnimation:UITableViewRowAnimationNone]; } } -(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{ if(indexPath.section == 0 && tableView.contentOffset.y < 0){ return -tableView.contentOffset.y+100;
but the reloadRows method resets the value of contentOffset to 0, so the tableview just stutters when I compress. It seems like if this does not work, I will have to write everything on a UIScrollView, and it seems like a huge pain without reusable cells.
Does anyone have any suggestions?
source share