试试吧,手动设置一个新的位置。
目标c
float width = CGRectGetWidth(scrollView.frame);
float height = CGRectGetHeight(scrollView.frame);
float newPosition = scrollView.contentOffset.x+width;
CGRect toVisible = CGRectMake(newPosition, 0, width, height);
[scrollView scrollRectToVisible:toVisible animated:YES];
夫特4
let scrollView = UIScrollView()
let width: CGFloat = scrollView.frame.size.width
let height: CGFloat = scrollView.frame.size.height
let newPosition: CGFloat = scrollView.contentOffset.x + width
let toVisible: CGRect = CGRect(x: newPosition, y: 0, width: width, height: height)
scrollView.scrollRectToVisible(toVisible, animated: true)
伟大的工作。 但我想知道哪个变量的值应该改变,以便滚动少于这个? – OOkhan
scrollView.contentOffset.x +? –
非常感谢帮助我的人。 – OOkhan