此代码运行完美,我可以滚动到最底端的图像:
ScrollView {
Image("MountainWelcomBackground").resizable().frame(height: 300)
Image("MountainWelcomBackground").resizable().frame(height: 300)
Image("MountainWelcomBackground").resizable().frame(height: 300)
Image("MountainWelcomBackground").resizable().frame(height: 300)
Image("MountainWelcomBackground").resizable().frame(height: 300)
}.edgesIgnoringSafeArea(.top)
但是如果我将此代码与偏移量一起使用:
ScrollView {
Image("MountainWelcomBackground").resizable().frame(height: 300)
Image("MountainWelcomBackground").resizable().frame(height: 300).offset(y: 500)
我无法滚动到底部,只能看到弹跳效果,将我滚动回到顶部。
View.offset
不会更改视图布局,只更改屏幕上的图形显示,因此滚动视图的内容/大小不会更改,并且像以前一样滚动]尚不清楚您的真实目标,但可能的解决方案是使用更改布局的工具,例如,最简单的方法是
Image("MountainWelcomBackground").resizable().frame(height: 300)
.padding(.top, 500)