本文介绍了contentOffset在UIScrollView中做了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UIScrollView contentOffset 属性的用途是什么?

What is the use of the contentOffset property in UIScrollView?

推荐答案

根据 contentOffset 属性表示:

简单来说,它是视图在每个方向(垂直和水平)移动的距离。您可以通过访问 CGPoint x y 属性来解包垂直和水平距离:

In plain speak, it's how far the view has moved in each direction (vertical and horizontal). You can unpack vertical and horizontal distance by accessing the x and y properties of the CGPoint:

CGFloat xOffset = _myScrollView.contentOffset.x;
CGFloat yOffset = _myScrollView.contentOffset.y;

这篇关于contentOffset在UIScrollView中做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 03:40
查看更多