Skip to content

Conversation

@scenee
Copy link
Owner

@scenee scenee commented Feb 5, 2020

FloatingPanelController asks the delegate for the content offset of a tracked scroll view pinned when a panel moves.

If you do not implement this method, the controller uses a value of the content offset plus the content insets. This method will not be called if the controller doesn't track any scroll view.

The reason why it's added is because a visual content origin of a scroll view is not always equal to its content offset plus its content insets. One of the cases is issue #304.

You can fix #304 by returning a value for a navigation bar with a large title as below.

return CGPoint(x: 0.0, y: 0.0 - trackedScrollView.contentInset.top - 148.0)

See also "Show Navigation Controller" in the Samples app.

@scenee
Copy link
Owner Author

scenee commented Feb 5, 2020

I'm considering whether the delegate name is appropriate or not. Please give me your advice if you have any ideas.

The content offset preservation should be applied only when
`FloatingPanelController.contentInsetAdjustmentBehavior` is `.always`.
This is because the library user loses control of the initial offset.
@scenee scenee merged commit 65f67c9 into master Feb 24, 2020
@scenee scenee deleted the iss-304 branch February 24, 2020 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with prefersLargeTitles when scrollview bounce locked.

2 participants