FloatingPanel
FloatingPanel copied to clipboard
UINavigationBar in FloatingPanelController include status bar height when anchor is tip/half
Description
Setting UINavigationController in FloatingPanelController, and do addPanel(toParent:)
when viewDidLoad, UINavigationBar height is wrong.
I considered that UINavigationBar height include status bar height.
This problem is occurred when floating panel anchor is tip or half, not full.


Expected behavior
UINavigationBar do not include status bar height.
Actual behavior
UINavigationBar included status bar height.
Steps to reproduce
- set UINavigationController in FloatingPanelController
-
addPanel(toParent:)
when viewDidLoad - wrong height navigationBar shown
Code example that reproduces the issue
class ViewController: UIViewController {
override func viewDidLoad() {
let fpc = FloatingPanelController()
let nc = UINavigationController(rootViewController: UIViewController())
fpc.set(contentViewController: nc)
fpc.addPanel(toParent: self)
}
}
How do you display panel(s)?
addPanel(toParent:)
How many panels do you displays? 1
Environment
Library version Latest (2.3.1)
Installation method
In any way
- CocoaPods
- Carthage
- Swift Package Manager
iOS version(s) 14.5
Xcode version Version 12.5 (12E262)
Thanks for reporting that. After my investigation, I figure out that it's out of scope of this library because UIKit doesn't provide an API to turn off the safe area and expansion of the navigation bar(UIViewController.edgesForExtendedLayout doesn't work well) :cry: But I found a workaround to escape this issue. That is adding a panel in viewDidAppear like below.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.fpc.addPanel(toParent: self, animated: true)
}
Thanks for investigation and workaround! I'll try this workaround👍