SwiftUI ScrollView 无法禁用垂直反弹? [英] SwiftUI ScrollView is not able to disable vertical bounce?

查看:71
本文介绍了SwiftUI ScrollView 无法禁用垂直反弹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有 ScrollView(alwaysBounceVertical: false) 的初始值设定项中有一个属性,但我似乎再也找不到它了.

There was a property in the initializer with ScrollView(alwaysBounceVertical: false) but I cant't seem to find it anymore.

有谁知道如何在 SwiftUI ScrollView 上禁用垂直反弹/过度滚动?

Does anyone know how I can disable the vertical bounce / overscroll on a SwiftUI ScrollView?

推荐答案

是的,它已从 ScrollView 的初始化程序中删除,现在您必须更新 UIScrollView 的外观以限制滚动.

Yes, it has been removed from the initializer of ScrollView, now you have to update the appearance of the UIScrollView in order to restrict the scrolling.

 UIScrollView.appearance().bounces = false 

这一行将限制滚动,您可以在 AppDelegate(didFinishLaunching) 或视图的 init() 方法中应用它.

This line will restrict the scrolling, you can apply this in the AppDelegate(didFinishLaunching) or the init() method of your View.

这篇关于SwiftUI ScrollView 无法禁用垂直反弹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆