如何停止在Swiftui滚动时坚持ScrollView的大型导航标题
I want to be able to drag down on the scroll view and the large navigation title must not stick to the content as it is hiding a view when scrolling down.
How can I disable this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我能够修复此行为的方式是在层次结构中添加假视图,以便滚动视图不是屏幕的基本视图,就像如果滚动浏览是基本视图,它会自动添加这种粘性行为。只需添加普通的
vstack
或emptleView
似乎也无法正常工作,因为它可以说滚动浏览仍然是基本视图。The way I was able to fix this behaviour is to add a fake view to the hierarchy so that the scrollview is not the base view of the screen, as it seems if the scrollview is the base view it automatically adds this sticky behaviour. Just adding a plain
VStack
orEmptyView
does not seem to work either as its able to tell that the scrollview is somehow still the base view.它应该与代表一样起作用,就像
It should work w/o representable, like
您可以添加视图以填充屏幕,例如
color
,然后将您的scrollview
应用于覆盖You can add a view to fill the screen such as a
Color
, and the apply yourScrollView
as an overlay