Inherits from | |
Conforms to | |
Framework |
/System/Library/Frameworks/UIKit.framework
|
Availability |
Available in iOS 2.0 and later.
|
Declared in |
UIScrollView.h
|
概述:
UIScrollView类,提供支持,来显示比应用窗口更大的内容。它让用户使用类似刷卡的动作来滚动内容。
UIScrollView是一些UIKit类的父类,包括 UITableView
and UITextView
.
UIScrollView对象的中心概念是,一个view可根据内容的大小来自我调整。
子类能够重载 touchesShouldBegin:withEvent:inContentView:
, pagingEnabled
, and touchesShouldCancelInContentView:
方法,来影响scrollView怎么处理滚动手势。
一个滚动视图也处理缩放和移动。
UIScrollView必须采纳 UIScrollViewDelegate协议。为了缩放和移动能有效的工作,必须实现
viewForZoomingInScrollView:
andscrollViewDidEndZooming:withView:atScale:
此外,最大和最小尺寸,必须不同。
重要:
你不应该嵌入UITableView或者UIWebView对象。如果你那样做了,意外的情况会发生。
任务:
管理内容的显示:
– setContentOffset:animated:
contentOffset
propertycontentSize
propertycontentInset
property- 管理滚动:
-
scrollEnabled
propertydirectionalLockEnabled
propertyscrollsToTop
property– scrollRectToVisible:animated:
pagingEnabled
propertybounces
propertyalwaysBounceVertical
propertyalwaysBounceHorizontal
property– touchesShouldBegin:withEvent:inContentView:
– touchesShouldCancelInContentView:
canCancelContentTouches
propertydelaysContentTouches
propertydecelerationRate
propertydragging
propertytracking
propertydecelerating
property- 管理滚动指示器:
-
indicatorStyle
propertyscrollIndicatorInsets
propertyshowsHorizontalScrollIndicator
propertyshowsVerticalScrollIndicator
property– flashScrollIndicators
- 缩放和移动
-
– zoomToRect:animated:
zoomScale
property– setZoomScale:animated:
maximumZoomScale
propertyminimumZoomScale
propertyzoomBouncing
propertyzooming
propertybouncesZoom
property- 管理委托:
delegate
property- 属性:
-
alwaysBounceHorizontal
一个bool值,决定水平方向是否可以滚动
@property(nonatomic) BOOL alwaysBounceHorizontal
alwaysBounceVertical
垂直方向(同上)