Skip to content

Commit 0c6d777

Browse files
committed
Disable layout adjustments during scrolling
I am experiencing the following scenario (bug): 1. Use selectViewController() 2. Sometimes during the animation viewWillLayoutSubviews() is called 3. For some reasons the last call of scrollViewDidScroll() is not with the final offset (the offset is very close to the final but not exactly equal). That's why progress is not 1.0 (in my cases it is something like 0.997..) and didFinishScrollingToViewController() is never called.
1 parent 817a8e8 commit 0c6d777

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

EMPageViewController/EMPageViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ public class EMPageViewController: UIViewController, UIScrollViewDelegate {
281281
public override func viewWillLayoutSubviews() {
282282
super.viewWillLayoutSubviews()
283283

284+
guard !scrolling else {
285+
return
286+
}
287+
284288
self.scrollView.frame = self.view.bounds
285289
if self.orientationIsHorizontal {
286290
self.scrollView.contentSize = CGSize(width: self.view.bounds.width * 3, height: self.view.bounds.height)

0 commit comments

Comments
 (0)