Fix jump when sheet first starts moving

This commit is contained in:
Shadowfacts 2020-01-04 14:35:23 -05:00
parent 808d3b3157
commit 78385359e1
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 4 additions and 0 deletions

View File

@ -154,6 +154,10 @@ open class SheetContainerViewController: UIViewController {
if scrollViewIsMovingSheet {
if initialScrollViewContentOffset == nil {
initialScrollViewContentOffset = scrollView.contentOffset
// if the sheet begins moving part way through the gesture, we need to ignore any translation
// that's already taken place, otherwise the sheet will jump when it starts moving
recognizer.setTranslation(.zero, in: scrollView)
}
scrollView.setContentOffset(initialScrollViewContentOffset!, animated: false)