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

SearchBar Cancel tap causes panel to dismiss #248

Closed
swiftymf opened this issue Aug 10, 2019 · 8 comments
Closed

SearchBar Cancel tap causes panel to dismiss #248

swiftymf opened this issue Aug 10, 2019 · 8 comments

Comments

@swiftymf
Copy link

swiftymf commented Aug 10, 2019

I have a searchBar in the tableHeaderView. Panel moves to .full when textField becomes active. If I tap the Cancel button the panel slides completely off the screen. As far as I can tell my code is almost identical to the Maps Sample project with similar functionality. I've checked delegates, positions when cancel is pressed, etc. If I change the position from .full to .half in searchBarTextDidBeginEditing it will change when I run the project. However when I make any change to searchBarCancelButtonClicked it will still fully slide the panel off the screen. I put a print statement in searchBarCancelButtonClicked to make sure it gets called when the button is pressed and it does. Not sure where else it would be dismissing the entire panel. Thanks in advance for your help and this awesome library!

EDIT: by setting definesPresentationContext to false, pressing Cancel on the searchBar now allows the tableView to go to .half position. However, if the searchBar's textField is active and you attempt to drag the view down manually, the searchBar stays at the top of the screen while the rest of the view slides down.

@swiftymf
Copy link
Author

swiftymf commented Aug 10, 2019

searchBarDetached

Hope this helps explain what's happening

EDIT: The gif lost some frames I guess, but you can see the searchBar doesn't stay attached to the tableHeaderView, even when the searchBar first becomes active.

@scenee
Copy link
Owner

scenee commented Aug 12, 2019

Could you tell me the following information?

  • iOS version
  • The library version
  • Xcode version

@swiftymf
Copy link
Author

swiftymf commented Aug 13, 2019

simulator iOS version: 12.2
library version: 1.6.2 (just updated to 1.6.3 but haven't tested it yet)
Xcode: 10.2.1

@scenee
Copy link
Owner

scenee commented Aug 13, 2019

Thanks, @swiftymf. I tried to repro this issue on 2 cases with Examples/Maps app, but I'm not able to do that...

  1. Add a panel as a child vc
  2. Present a panel modally

I wonder if what is the difference between your app and Examples/Maps.

@swiftymf
Copy link
Author

Could it be because I’m adding the searchBar this way tableView.tableaheaderView = searchViewController.searchBar, instead of in storyboard?

@scenee
Copy link
Owner

scenee commented Aug 14, 2019

I've understood this issue after my investigation for a while.

In conclusion, we're not able to use UISearchController with FloatingPanelController by the system design.

This is because UISearchController automatically presents itself modally when a user interacts with the search bar. When it displays, it swaps the superview of the search bar into the view managed by itself from the table view. As a result, FloatingPanelController can't control the search bar when UISearchController is active, as you can see from this screen shot.

Screen Shot 2019-08-14 at 20 07 58

I tried to find a workaround, including new APIs on iOS 13, but I was not able to find it.

@scenee scenee closed this as completed Aug 15, 2019
@eduguru
Copy link

eduguru commented Jun 29, 2022

was there a solution found for this? any workaround. am experiencing the same issue

@Issalk
Copy link

Issalk commented Dec 16, 2024

was there a solution found for this? any workaround. am experiencing the same issue

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

No branches or pull requests

4 participants