Skip to content

Translucent navbar don't change title color #135

Open
@Michae1Nechaev

Description

@Michae1Nechaev

ezgif-5-e296070553

I open the same vc two times:
first time I go back using Back button
second time I go back using standard left edge swipe gesture

In first example navBar title don't changed to white color (it keeps black color like on the second vc)
In second example navBar title changed title color to white successfuly.

In both cases runs same code in viewWillAppear and viewWillDissappear methods in same order, but with different result

First vc:

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.navigationBar.barStyle = .black
        navigationController?.navigationBar.tintColor = .white

        navigationController?.navigationBar.isTranslucent = false
        navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
        navigationController?.navigationBar.shadowImage = nil
}

Second vc:

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)        
        
        navigationController?.navigationBar.barStyle = .default
        navigationController?.navigationBar.backgroundColor = .clear
        navigationController?.navigationBar.tintColor = MainColor
        
        navigationController?.navigationBar.isTranslucent = true
        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
        navigationController?.navigationBar.shadowImage = UIImage()
}

override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        navigationController?.navigationBar.isTranslucent = false
        navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
        navigationController?.navigationBar.shadowImage = nil
        
        navigationController?.navigationBar.backgroundColor = .clear
        navigationController?.navigationBar.tintColor = .white
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions