Seems like this has been asked before but I tried all the solutions but they don't seem to work. I tried both the solutions :
if scrollView.isPagingEnabled {
if scrollView.scrollToBottom() == true {
scrollView.isPagingEnabled = false
}
} else {
if scrollView.scrollToBottom() == false {
scrollView.isPagingEnabled = true
}
}
And
scrollView.isPagingEnabled = self.scroll_course_detail.contentOffset.y < (self.scroll_course_detail.contentSize.height - self.scroll_course_detail.frame.size.height)
Here are the values which I get in the logs :
print("self.contentSize.height : \(self.contentSize.height)")
print("self.frame.size.height : \(self.frame.size.height)")
print("self.contentOffset.y : \(self.contentOffset.y)")
self.contentSize.height : 597.405
self.frame.size.height : 520.0
self.contentOffset.y : 75.0
The difference between self.contentSize.height
and self.frame.size.height
comes out to be 77.405 (not 75). And I cannot do a static check by adding that extra 2.405 since that would not handle other cases.
I cannot disable paging for scrollView since I am using it.