导航栏上带有大标题的动画搜索错误

时间:2018-10-28 12:10:29

标签: swift uinavigationcontroller

我的错误:
enter image description here

如果从启用了大标题的视图控制器导航到禁用了大标题的视图控制器,我会看到相同的错误。高度导航栏变化不平稳。

我希望动画在另一个这样的viewController上进行搜索时更改高度navBar enter image description here

在BaseNavigationController中设置的navBar的公共属性

class BaseNavigationController: UINavigationController {

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}

override func viewDidLoad() {
    super.viewDidLoad()

    setNavBarTitlesPropertyes()
}

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
}

private func setNavBarTitlesPropertyes() {
    navigationBar.tintColor = .white
    navigationBar.titleTextAttributes = [
        .foregroundColor: UIColor.white
    ]
    if #available(iOS 11.0, *) {
        navigationBar.prefersLargeTitles = true

        navigationBar.largeTitleTextAttributes = [
            .foregroundColor: UIColor.white
        ]
    }
}

还有我在情节提要中设置的导航栏:

enter image description here

1 个答案:

答案 0 :(得分:0)

我找到了解决此问题的方法。 UINavigationBar  属性半透明应为true,并且UIViewController中tableView的bottom和top约束也应分别等于Superview.Top和Superview.Bottom。

相关问题