【问题标题】:Animation segue bug on the navigation bar with large title带有大标题的导航栏上的动画segue错误
【发布时间】:2018-10-28 12:10:29
【问题描述】:

我的错误:

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

我希望在这样的另一个 viewController 上的 segue 期间动画更改高度 navBar

在 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
        ]
    }
}

还有我在故事板中的设置导航栏:

【问题讨论】:

    标签: swift uinavigationcontroller


    【解决方案1】:

    我找到了解决这个问题的方法。 UI导航栏 属性 translucent 应该是 true,并且 UIViewController 中 tableView 的底部和顶部约束应该相应地等于 Superview.Top 和 Superview.Bottom。

    【讨论】:

      猜你喜欢
      • 2020-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多