Last active
December 4, 2018 05:17
-
-
Save AKupetskiy/08bcd5ffb33e69a0b9f5db98f93f2b9b to your computer and use it in GitHub Desktop.
Fix: UITableView scrolls to top after method [tableView endUpdates]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
CGPoint offset = tableView.contentOffset; | |
[tableView beginUpdates]; | |
// do something | |
[tableView endUpdates]; //<- this method causes scrolling | |
[tableView.layer removeAllAnimations]; | |
[tableView setContentOffset:offset animated:NO]; //<- Voilà! Now it works perfect :] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment