我正在使用 UINavigationItem
的 titleView
属性在 ViewController 的 UINavigationBar
中心设置 View 。问题是,当我推送另一个具有相同 titleView
的 ViewController 时,它会闪烁。
这是我在 ViewController 中设置 titleView
的方法
let view = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
view.backgroundColor = .red
self.navigationItem.titleView = view
我可以采取什么措施来防止这种情况发生?
最佳答案
我最终使用了自定义 View 并将其作为 subview 添加到 UINavigationBar
中。我还将 UINavigationItem
的 titleView
设置为空白 View ,以防止 LargeTitle 出现在我的 View 中。
关于ios - 防止 UINavigationItem 的 TitleView 闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48754638/