I'm using UINavigationItem
s titleView
property to set view in center of UINavigationBar
of my ViewController. The problem is, when I push another ViewController with same titleView
, it blinks.
Here is how I set titleView
inside my ViewControllers
let view = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
view.backgroundColor = .red
self.navigationItem.titleView = view
What can I do to prevent this?
I ended up using custom view and adding it as subView to UINavigationBar
. I'm also setting UINavigationItem
s titleView
to blank view to prevent LargeTitle from appearing in place of my view.