简体   繁体   English

禁用 iOS 11 大标题“捕捉”

[英]Disable iOS 11 large title "snapping"

When large titles are enabled on iOS 11 and you scroll down or up and the title changes from large to inline ( automatic ), there is a "snapping" that you can feel.当在 iOS 11 上启用大标题并且您向下或向上滚动并且标题从大变为内联( automatic )时,您会感觉到“捕捉”。

The contacts app also has large titles, but it doesn't "snap" automatically.联系人应用程序也有大标题,但它不会自动“捕捉”。

How can I turn this behavior off?如何关闭此行为?

I think I understand what you're asking for because I had a similar issue, perhaps you could provide a screen recording just to be sure? 我想我了解您的要求,因为我遇到了类似的问题,也许您可​​以提供屏幕录像以确保?

I faced this issue when setting a custom barTintColor , in my case .white which would cause the effect that I think you're describing. 我在设置自定义barTintColor时遇到了这个问题,在我的情况下.white会导致我认为您正在描述的效果。

I fixed this by making my bar translucent and setting the tint to UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.99) . 我通过使栏变为半透明并将色调设置为UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.99)

Hope that helps you! 希望对您有帮助!

I've found there are a few things that can cause this:我发现有一些事情会导致这种情况:

  • The UIScrollView (table view, collection view, etc) top is pinned to the safe area. UIScrollView (表格视图、集合视图等)顶部固定到安全区域。 It should be pinned to its superview instead.它应该被固定到它的超级视图。
  • The nav bar is opaque but the VC's extendedLayoutIncludesOpaqueBars is false.导航栏是不透明的,但 VC 的extendedLayoutIncludesOpaqueBars是假的。 This can be set in the storyboard or in code.这可以在故事板或代码中设置。
  • The VC's edgesForExtendedLayout doesn't include the top bar. VC 的edgesForExtendedLayout不包括顶栏。 It needs to.它需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM