Skip to content

UIScrollView

UIScrollView 提供滚动与缩放能力。插件环境里你会在很多“可滚动视图”类型上见到它的属性与方法。

属性类型说明
contentOffsetany内容偏移。
contentSizeany内容尺寸。
contentInsetany内容内边距。
scrollIndicatorInsetsany滚动条内边距。
showsVerticalScrollIndicatorboolean是否显示垂直滚动条。
showsHorizontalScrollIndicatorboolean是否显示水平滚动条。
scrollEnabledboolean是否允许滚动。
pagingEnabledboolean是否分页滚动。
bouncesboolean是否回弹。
alwaysBounceVerticalboolean是否始终垂直回弹。
alwaysBounceHorizontalboolean是否始终水平回弹。
bouncesZoomboolean缩放是否回弹。
zoomScalenumber当前缩放比例。
minimumZoomScalenumber最小缩放。
maximumZoomScalenumber最大缩放。
deceleratingboolean是否正在减速。
draggingboolean是否正在拖拽。
trackingboolean是否正在跟踪。
zoomingboolean是否正在缩放。
zoomBouncingboolean是否正在缩放回弹。
decelerationRatenumber减速率。
directionalLockEnabledboolean是否方向锁定。
scrollsToTopboolean是否点击状态栏滚到顶部。
indicatorStylenumber滚动条样式。
delaysContentTouchesboolean是否延迟内容触摸。
canCancelContentTouchesboolean是否可取消内容触摸。
delegateany委托。
panGestureRecognizerUIPanGestureRecognizer拖拽手势。
pinchGestureRecognizerUIPinchGestureRecognizer捏合手势。

设置内容偏移(可选动画)。

setContentOffsetAnimated(contentOffset: any, animated: boolean): void

Parameters:

NameTypeDescription
contentOffsetany目标偏移(如 { x, y })。
animatedboolean是否动画。

Return Value:

  • 无。

滚动使矩形可见。

scrollRectToVisibleAnimated(rect: any, animated: boolean): void

Parameters:

NameTypeDescription
rectany目标矩形。
animatedboolean是否动画。

Return Value:

  • 无。

短暂显示滚动条。

flashScrollIndicators(): void

Return Value:

  • 无。

设置缩放比例(可选动画)。

setZoomScaleAnimated(scale: number, animated: boolean): void

Parameters:

NameTypeDescription
scalenumber目标缩放。
animatedboolean是否动画。

Return Value:

  • 无。

缩放到指定矩形。

zoomToRectAnimated(rect: any, animated: boolean): void

Parameters:

NameTypeDescription
rectany目标矩形。
animatedboolean是否动画。

Return Value:

  • 无。

当前运行时未额外暴露 UIScrollView 的类成员。

头文件 API 清单

正在加载…

协议:,来源: