答案 0 :(得分:0)
我认为如果您使用滑动手势,您可以执行以下操作:
let swipeGesture = UISwipeGestureRecognizer()
let scrollView = UIScrollView()
swipeGesture.direction = .right
swipeGesture.addTarget(self, action: #selector(scrollToBeginning))
@objc func scrollToBeginning() {
scrollView.setContentOffset(.zero, animated: true)
}
或使用scrollView.scrollRectToVisible(CGRect(x: 0, y: 0, width: 1, height: 1), animated: true)