I am creating a chat application, everything is going fine until I started using auto scroll for a UITableView when the keyboard is displayed up / down.
The size of indexPathsForVisibleRows indexPathsForVisibleRows increased after scrolls, even if the height of each row / cell is constant. I searched here and found out that there was a mistake. According to the suggestions, I added the following line:
[table visibleCells]
before using indexPathsForVisibleRows :
scrollPosition = (NSIndexPath*)[[table indexPathsForVisibleRows] objectAtIndex:0];
in
- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
This fixed the problem when the keyboard was hidden and the table was full (not changed).
When the user clicks on textField, the keyboard appears, and the height of the UITableView decreases by the amount of keyboard height.
At this point, when scrolling occurs, bypassing use
[table visibleCells]
does not work, and the final size of indexPathsForVisibleRows NSArray becomes full rows of the table, not just visible.
Is this another mistake or am I something wrong?
source share