【问题标题】:The navigationItem on NavigationBar is shifted when scrolling on tableView在 tableView 中滚动时,导航栏上的导航项发生移动
【发布时间】:2021-01-11 12:37:08
【问题描述】:

当我在 tableView 上滚动时,navigationItem 不会隐藏并稍微移动到底部。 我在较低版本(iOS 13、iOS 12)上尝试过,但是这个问题发生在 iPhone 11(iOS 14)上。 我搜索了任何资源以找到解决方案,但它仍然对我没有帮助。 那我现在该怎么办?

        UINavigationBar.appearance().barTintColor = UIColor.playerDefaultColor
        UINavigationBar.appearance().isTranslucent = false
        UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
        UINavigationBar.appearance().shadowImage = UIImage()
        UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
        UINavigationBar.appearance().tintColor = UIColor.white

        UITabBar.appearance().tintColor = UIColor.premiumFontActiveColor

【问题讨论】:

    标签: ios swift uitableview uiscrollview uinavigationitem


    【解决方案1】:

    如果UITableView 是视图层次结构中的第一个视图,您可以尝试在 tablview 上方放置一个空视图。如果这样可以解决问题,您可以将该视图保留在 xib 中并将其隐藏。这听起来很奇怪,但我在以前版本的 xcode 中遇到了同样的问题,该解决方案已修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-03
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      • 2015-10-07
      • 2020-11-16
      • 1970-01-01
      相关资源
      最近更新 更多