Skip to content

Bottom view allows for right and left scroll #11

@zalsaeed

Description

@zalsaeed

I think this qualifies to be a bug. However, since I have heavily changed the original code there is a possibility that I have introduce something caused the problem.

In the VericalScrollViewController class the method outerScrollViewShouldScroll if I understand this correctly is responsible of disabling the horizontal scrolling on the outer vertical views (top and bottom). The method works fine for the top view since the condition scrollView.contentOffset.y < middleVc.view.frame.origin.y will catch anything that is placed to the top of the the middle (main) view. However, when it comes to the bottom one the condition scrollView.contentOffset.y > 2*middleVc.view.frame.origin.y is not accurate since it slightly exclude the bottom view. For example, if we arbitrarily assume that the y origin value for the main view is 6 and its height is 6 as well, then the y origin value for the bottom view would be 12. Given the condition 12 is equal to 2*6 thus the horizontal scrolling is enabled and one can go from the bottom view to the right and left ones. I think the safest is to change the conditional scrollView.contentOffset.y > 2*middleVc.view.frame.origin.y to scrollView.contentOffset.y > middleVc.view.frame.origin.y. Also, I think it is possible to change the whole condition to if scrollView.contentOffset.y != middleVc.view.frame.origin.y {return false} but I don't know if this will introduce navigation difficulties due to high accuracy.

Finally, thanks for sharing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions