iOS black line on navigation controller transition

Viewed 719

When the push/pop transition is performed on my view controller(which has large title and search bar embedded in navigation item), the black line appears briefly, like this:

enter image description here

I've basically tried changing all the navigation bar colour related things, but nothing helped.

Any help would be appreciated :)

2 Answers
extension UINavigationBar {


    var customStyle: NavigationBarCustomStyle {
        set(style) {
            switch style {
            case .clear:
                self.setBackgroundImage(UIImage(), for: .default)
            self.shadowImage = UIImage()
            self.tintColor = .white
            self.isTranslucent = false

                break
            case .bottomLine:
                self.tintColor = .gray
                self.backgroundColor = .yellow
                self.isTranslucent = false
                break
            }
        }
        get {
            return self.customStyle
        }
    }
}

enum NavigationBarCustomStyle {
    case clear
    case bottomLine
//  case white
}

at ViewController >> viewDidLoad method put below line:

self.navigationController?.navigationBar.customStyle = .clear

Try set navbar's background color to white (depend on your case) fix the problem for me, though there still another glitch but its better :)

override func viewDidLoad() {
    super.viewDidLoad()

    self.navigationController?.view.backgroundColor = .white
}
Related