I want to hide a FabButton everytime a floatingViewController appears and show it again when I close the view.
I tried hiding the FabButton itself with
self.menuButton.hidden = true
but there isn't a callback function when I close the floatingViewController so I dont have a way to un hide it.
I also tried setting the zPosition manually but the button is unaffected
Is there a better approach to this?
The NavigationBarViewController has delegation methods for detecting the state of the floatingViewController. Set the delegate object,
navigationBarViewController?.delegate = self
Then try out the delegate methods:
extension AppNavigationBarViewController: NavigationBarViewControllerDelegate {
/// Delegation method that executes when the floatingViewController will open.
func navigationBarViewControllerWillOpenFloatingViewController(navigationBarViewController: NavigationBarViewController) {
print("Will Open")
}
/// Delegation method that executes when the floatingViewController will close.
func navigationBarViewControllerWillCloseFloatingViewController(navigationBarViewController: NavigationBarViewController) {
print("Will Close")
}
/// Delegation method that executes when the floatingViewController did open.
func navigationBarViewControllerDidOpenFloatingViewController(navigationBarViewController: NavigationBarViewController) {
print("Did Open")
}
/// Delegation method that executes when the floatingViewController did close.
func navigationBarViewControllerDidCloseFloatingViewController(navigationBarViewController: NavigationBarViewController) {
print("Did Close")
}
}
You should be able to use these methods to achieve the desired effect.