I have a problem with the new navigation bar for iOS 11.
In root view set new navigation by code:
if (@available(iOS 11.0, *)) {
self.navigationController.navigationBar.prefersLargeTitles = YES;
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAlways;
}
Then from root view, I pushed to another view and set code navigation bar by
if (@available(iOS 11.0, *)) {
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
}
It works well. However, when push and pop view a black color appeared like the image below:
I don't know why the black color appeared on this view although I did not set back ground for navigation bar is a black color for the whole screen in my app.
Someone have any idea for the problem. Please drop me some suggestion to solve that bug. Thanks.
On your Mac, use Dock & Menu Bar System Preferences to change the appearance of the Dock, and to select items to show in the menu bar and in Control Center. To change these preferences, choose Apple menu > System Preferences, then click Dock & Menu Bar .
Change the Bar StyleA user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.
The appearance settings for the navigation bar when the edge of scrollable content aligns with the edge of the navigation bar. iOS 13.0+ iPadOS 13.0+ Mac Catalyst 13.1+ tvOS 13.0+
I solved this issue by setting navigation controller background colour in the UIViewController class where I am getting black colour.
Here is the code I used :
navigationController?.view.backgroundColor = UIColor.white
I have tried changing background colours and shadows in story board but it doesn't seem to fix this issue. Hopefully this answer is still relevant here.
I solved this in my own app by subclassing UINavigationController and setting its view.backgroundColor
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With