Reputation: 9730
We are currently having an issue with navigation bar sizing when using modal presentation in iOS 13.
In most cases this works fine as can be seen in this screenshot:
However, in a few screens we get this weird effect, with the navigation bar having a lower height and a weird "see-through" gap between it and the view. As seen in this screenshot:
Both of the view controllers have the same values set for their properties, are modally presented and have the same constrains on their subviews (0 spacing from the superview/margins/top layout guide).
This issue doesn't happen in iOS 12, even when built with the iOS 13 SDK. Is this a known issue in iOS 13 (beta 8), or is there something we should adjust in the code/storyboard?
Upvotes: 28
Views: 4911
Reputation: 109
In case these answers don't work make sure to set the navigation bar type to "Standard".
Upvotes: 0
Reputation: 1019
Like Rod's answer, but I found it only works if I put setNeetsLayout() in next main thread runLoop:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Workaround for iOS 13 modal gap below navigationbar
if #available(iOS 13.0, *) {
DispatchQueue.main.async {
self.navigationController?.navigationBar.setNeedsLayout()
}
}
}
Upvotes: 19