Last active
April 9, 2020 09:08
-
-
Save quinncnl/4bcd363faae942aea9d32622793b8de4 to your computer and use it in GitHub Desktop.
How to detect when a UIScrollView has finished scrolling
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
// http://stackoverflow.com/questions/993280/how-to-detect-when-a-uiscrollview-has-finished-scrolling | |
func scrollViewDidScroll(scrollView: UIScrollView) { | |
performSelector(#selector(UIScrollViewDelegate.scrollViewDidEndScrollingAnimation(_:)), withObject: nil, afterDelay: 0.3) | |
} | |
func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) { | |
print("scrollViewDidEndDecelerating") | |
NSObject.cancelPreviousPerformRequestsWithTarget(self) | |
refreshArtworks() | |
} | |
func refreshArtworks() { | |
if let userlikeArray = userlikeArray { | |
for indexPath in tableView.indexPathsForVisibleRows! { | |
if let cell = self.tableView.cellForRowAtIndexPath(indexPath) as? LikesTableViewCell { | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment