-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
Totem Sep 20, 2017 5:54 PM (in response to Neuronical)I'm in the same boat. I was able to remove the black line by changing the barStyle to ".black", but it replaced it with what looks like an image with an alpha of 0.5, so I get a lighter version of the color of both my nav bar and search bar. Setting the shadowImage to a transparent image does nothing.
-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
miroslav.hajek Sep 21, 2017 4:58 AM (in response to Neuronical)Can you report this issue as a bug? I have same problem with shadow image under navigation bar with search controller or search bar.
-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
raphaklr Sep 25, 2017 12:29 PM (in response to Neuronical)Same thing here...
-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
marian.cerny Oct 20, 2017 7:53 AM (in response to Neuronical)Seems to be a bug in iOS 11.
Checking the view hierarchy Apple is now using two shadow image views - one when there is searchController and one when there is none. The shadow image view also is not a subview of the navigation bar.
Here is a hack I have used to fix this:
func fixShadowImage(inView view: UIView) { if let imageView = view as? UIImageView { let size = imageView.bounds.size.height if size <= 1 && size > 0 && imageView.subviews.count == 0, let components = imageView.backgroundColor?.cgColor.components, components == [1, 1, 1, 0.15] { print("Fixing shadow image") let forcedBackground = UIView(frame: imageView.bounds) forcedBackground.backgroundColor = .white imageView.addSubview(forcedBackground) forcedBackground.autoresizingMask = [.flexibleWidth, .flexibleHeight] } } for subview in view.subviews { fixShadowImage(inView: subview) } }
Search for image view with height between in 0 and 1 with white color and 0.15 alpha.
If found, add a subview with custom background color.
Usage:
override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if let window = view.window { fixShadowImage(inView: window) } }
-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
mjlin Jun 9, 2018 4:10 PM (in response to Neuronical)I still see this issue with iOS 11.4 on devices. I see it on iOS 12 beta 1 simulators, too. Wondering when Apple is going to fix this issue.
-
Re: iOS11 Can't change shadowImage on UINavigationBar when searchController is set
REVEES Oct 22, 2018 11:54 PM (in response to Neuronical)any progress?