I had tried following code to set background image of UINavigationBar.
It was working fine before Xcode 9 but in Xcode 9 image are not set properly.
UIImage *image = [UIImage imageNamed:@"headr_bg"];
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
Xcode 9 image 1
Xcode 9 image 2
[before Xcode 9]
may be its not perfect solution & but i had old project in that i had fixed it by below code. Just updated navigation bar position and navigation view frame for ios version > 11.
CGRect navbarFrame = self.navigationController.navigationBar.frame;
CGRect navFrame = self.navigationController.view.frame;
navbarFrame.size.height = 44;
navFrame.origin.y = 20;
self.navigationController.navigationBar.frame = navbarFrame;
self.navigationController.view.frame = navFrame;
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