UIScrollView简介
The UIScrollView class provides support for displaying content that is larger than the size of the application’s window. It enables users to scroll within that content by making swiping gestures, and to zoom in and back from portions of the content by making pinching gestures.
以上是来自于Apple官方文档的介绍,从以上介绍我们知道
- UIScrollView 是为了用来显示那些比设备界面尺寸要大的内容而设计的一种View。
2.UIScrollView是支持用户通过滑动来浏览内容,并且可以通过手指捏合动作来缩放界面。
![](https://img.haomeiwen.com/i1643791/55b208c7a06c67c4.png)
![](https://img.haomeiwen.com/i1643791/35f50af1641d79c1.png)
![](https://img.haomeiwen.com/i1643791/0415705e8ba73af0.png)
从上面的图片我们可以清楚的看出设备的界面可以看到整个图片的一部分。
这里有几个属性比较重要
- contentSize --显示的内容的尺寸大小
- contentOffset --可是框的位移
- contentInset --内容边框尺寸
UIScrollView需要实现的代理
在我们使用UIScrollView的过程中我们必须实现UIScrollViewDelegate中的方法。
![](https://img.haomeiwen.com/i1643791/79935528f94ae5c1.png)
通过以上的代理我们可以响应UIScrollView 执行的相关操作。
网友评论