跳到主要内容

获取当前可滚动控件的偏移(:scrollCurrPoint)

函数

横向偏移, 纵向偏移 =  obj:scrollCurrPoint()

返回值

  • 横向偏移 浮点型
  • 纵向偏移 浮点型

说明

该函数可以获取 UIScrollView 及其子类 如(UITableView,UICollectionView,UIWebView ,WKWebView) 偏移的位置

此方法只能在 2.3.0以上版本中使用

示例


local node = nodeView.matchForMainWindow(function (info) -- 匹配出应用中 UITableView
return info.superClass == "UITableView"
end ,true)
if (#node > 0) then
print(node[1]:scrollCurrPoint()) --打印出 横向和纵向的偏移
end