How can I make a UIScrollView
start scrolling from top to bottom. When i swipe(down) it will scroll down first not up and disappear. What i have now is, i can scroll up first and then down, while scrolling down it's disappear.
Here is my code -
func scrollViewDidScroll(_ scrollView: UIScrollView) {
//for toogle swipe view
if scrollView.contentOffset.y < 120 {
self.swipeMsgView.isHidden = false
}else {
self.swipeMsgView.isHidden = true
}
//for making bottom inset
if scrollView.contentOffset.y < 190 {
var contentInset:UIEdgeInsets = scrollView.contentInset
contentInset.bottom = scrollView.contentOffset.y-100
scrollView.contentInset = contentInset
}
//when swipe down
if scrollView.contentOffset.y == 0 {
if !isScrollDownFirstTime{
UIView.animate(withDuration: 0.5, animations: {
self.dismiss(animated: true, completion: nil)
})
}
}
//for tracking first time scrolling
if scrollView.contentOffset.y > 150 {
isScrollDownFirstTime = false
}
}
It works fine. But i want to disappear the view when a user swipes or scroll down first (swipe gesture is not working). Is there any elegant way to do this with this existing feature?Thank you.