I am trying to log some events when a user scrolls the 50% of the scrollView contents.
I can get the scroll amount with scrollView.contentOffset.y as following:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSLog(@"%f",scrollView.contentOffset.y);
}
Swift:
func scrollViewDidScroll(_ scrollView: UIScrollView) {
print(scrollView.contentOffset.y)
}
As I scroll down to the bottom of the scrollView I can find out about the height of contentArea once I hit the bottom, lets say that value is 2000 and I can hardcode the value of 1000 since I am interested only when user exceeds the 50% of the whole contentSize.
But I want it to be dynamic, since dataSource of tableView might change in the future, which would result in the bottom of scrollView's offset to be greater or less than 2000.
I would like to know if it is possible to detect the maximum contentOffset value for a tableView even before scrolling to the bottom?
Thanks in advance.