Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with prefersLargeTitles when scrollview bounce locked. #304

Closed
DhavalBhimani opened this issue Jan 7, 2020 · 5 comments · Fixed by #314
Closed

Issue with prefersLargeTitles when scrollview bounce locked. #304

DhavalBhimani opened this issue Jan 7, 2020 · 5 comments · Fixed by #314

Comments

@DhavalBhimani
Copy link

DhavalBhimani commented Jan 7, 2020

Short description

When i set UINavigationController controller as contentViewController and use prefersLargeTitles for rootviewcontroller of it. i am not able to get title back to its position when scroll down the floatingpanelcontroller. and title sticks to the top. Is there any solution for this in FloatingPanel

Thanks.

ezgif-2-4f403aed2ea3

Expected behavior

  • title should go back to large title when scrolled down.

Actual behavior

  • It breaks the title UI. some time it goes back and some times it stays on top.

Code example that reproduces the issue
let nav = UINavigationController(rootViewController: self.nearByVC) self.floatingPanelController.set(contentViewController: nav) self.floatingPanelController.track(scrollView: self.nearByVC.tableView) self.floatingPanelController.isRemovalInteractionEnabled = false self.floatingPanelController.surfaceView.contentInsets = .init(top: 20, left: 0, bottom: 0, right: 0)

Environment

Debug
Library version
1.71
Installation method
pod 'FloatingPanel'

iOS version(s)
13.3
Xcode version
11.3

@scenee
Copy link
Owner

scenee commented Jan 23, 2020

Thank you for your report. I've acknowledged this issue. I'm going to try to fix this issue.

@jsm174
Copy link

jsm174 commented Jan 31, 2020

I'm having a similar issue.

I have the following stack:

TabBarController
   (Selected Tab)
      NavigationController
         ViewController
             FloatingPanel
                 NavigationController
                     TableViewController

When I set the UINavigationController to prefersLargeTitles, the minute I start scrolling the tableView, it shrinks about the height of large titles. (From the pic, the bottom of the scroll indicator is the bottom of the UITableViewController)

floating

@jsm174
Copy link

jsm174 commented Jan 31, 2020

So I played with this some more.

When the fcp contains a navigation controller, and your using that fcp in a tab of a uitabviewcontroller, I needed to subtract the height of the tab bar from the surfaceView's content insents.

fpc.surfaceView.contentInsets = .init(top: 0, left: 0, bottom: -83, right: 0)

@scenee
Copy link
Owner

scenee commented Feb 4, 2020

Thanks you @jsm174. Yeah I've confirmed it's related to the content insets.
I figured out that a scroll view in a nav bar displaying a large title needs to consider its safe area inset to calculate the visual offset zero.
Therefore I'm planning to add a new delegate method to control scrolling a content in a tracking scroll view against the panel's pan gesture.

@scenee
Copy link
Owner

scenee commented Feb 27, 2020

Please use floatingPanel(_:contentOffsetForPinning:) to achieve this expected behavior. This new delegate method will be released in v1.7.3. Here is an example. Thank you.

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 a pull request may close this issue.

3 participants