简体   繁体   English

SwiftUI:NavigationView 中列表的导航标题卡在原位(滚动动画损坏)

[英]SwiftUI: Navigation Title Stuck in Place (Scroll Animation Broken) for List in NavigationView

I have created a SwiftUI List wrapped in a NavigationView .我创建了一个包含在NavigationView的 SwiftUI List The title for the list is set in the default way and appears fine: .navigationBarTitle("My Title") .列表的标题以默认方式设置并且显示正常: .navigationBarTitle("My Title") The problem is the scrolling behavior is broken.问题是滚动行为被破坏了。

That is, when scrolling the list, the large title should disappear to make way for the navigation bar to appear with the small title.也就是说,当滚动列表时,大标题应该消失,让导航栏与小标题一起出现。 However, the large title is just stuck in place and does not move while the list scrolls behind it in a glitchy looking manner.然而,大标题只是卡在原地,当列表以一种看起来有问题的方式在它后面滚动时不会移动。

Turns out, setting the background of the List breaks the scrolling behavior.事实证明,设置List的背景会破坏滚动行为。 That is, removing .background(Color.red) on the List restored the scrolling behavior to normal.也就是说,删除List上的.background(Color.red)使滚动行为恢复正常。

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

相关问题 SwiftUI 列表行分隔符样式无法与导航一起正常工作 - SwiftUI list line separatorStyle not work correctly with navigation 如何在 SwiftUI 中制作指向可扩展列表的导航链接 - How to make navigation link to expandable list in SwiftUI SwiftUI - 滚动列表时视图中的动画停止 - SwiftUI - Animation in view stops when scrolling the list SwiftUI 列表重置滚动任何视图更改 - SwiftUI List reset scroll on any view change SwiftUI:在 ScrollView 或 List 内时,PageTabViewStyle() 新损坏? - SwiftUI: PageTabViewStyle() newly broken when inside ScrollView or List? SwiftUI.shadow 阻止除第一个列表 {} 之外的所有列表滚动手势。 为什么? - SwiftUI .shadow blocks List scroll gesture for all but first List {}. Why? SwiftUI:导航在带节的列表中无法正常工作 - SwiftUI: Navigation doesn't work properly in List with Sections SwiftUI:List 在 HStack 中弄乱了其子视图的动画 - SwiftUI: List is messing up animation for its subviews inside an HStack SwiftUI:向后无限滚动 - SwiftUI: backwards infinite scroll 使用 SwiftUI Navigation View 和 Sorted FetchRequest 在详细视图中重新排列列表项时出现问题 - Issue when rearranging List item in detail view using SwiftUI Navigation View and Sorted FetchRequest
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM