I have view controller in my storyboard with prompt text line but when I'm pushing a new view controller without prompt line in the navigation bar i get this (see picture) black space between the navigation bar and the view controller main view.
i already tried to remove the prompt using this:
[self.navigationItem setPrompt:nil];
but i still having this problem.
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+
Here is a work-around for setPrompt. It doesn't animate, so it I'm calling it a work-around instead of a solution. Must be in viewDidAppear, not viewWillAppear.
-(void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// This is needed for apple bug with self.navigationItem.prompt
[self.navigationController.navigationBar setNeedsUpdateConstraints];
}
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