Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImageView getting attached to _UIBarBackground

Following is the screenshot of the issue:-

Not sure why is uiimageview getting added , and what is _UIBarBackGround ? enter image description here

Any help is appreciated.

Complete Flow screenshot:-

enter image description here

like image 871
Meet Avatar asked Nov 30 '25 02:11

Meet


2 Answers

I had the same problem, but with the UITabBar

Change the UIBarStyle to black

public enum UIBarStyle : Int {

    
    case `default` = 0

    case black = 1

    
    @available(iOS, introduced: 2.0, deprecated: 13.0, message: "Use UIBarStyleBlack instead.")
    public static var blackOpaque: UIBarStyle { get }

    @available(iOS, introduced: 2.0, deprecated: 13.0, message: "Use UIBarStyleBlack and set the translucent property to YES instead.")
    case blackTranslucent = 2
}

tabBar.barStyle = .black

like image 125
Mario Dominguez Avatar answered Dec 02 '25 15:12

Mario Dominguez


I had a problem with that UIImageView while adding a new UINavigationController to a project of my co-workers.

Basically, that is a part of a predefined class so I don't consider deleting it to be a good idea. But I made it transparent. To do so I overrode the function viewDidLoad and added this code:

if #available(iOS 13.0, *) {
    let navBarAppearance = UINavigationBarAppearance()
    navBarAppearance.backgroundColor = UIColor.clear
    navigationController?.navigationBar.standardAppearance = navBarAppearance
}

That made the background added in the superclass by my colleagues disappear. Some other elements in UINavigationController wasn't transparent so I overrode also the function viewWillAppear and added there:

let bar = self.navigationController?.navigationBar
bar?.isTranslucent = true
bar?.backgroundColor = .clear
bar?.standardAppearance.backgroundEffect = nil
like image 42
Dawid H Avatar answered Dec 02 '25 16:12

Dawid H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!