How to find the scroll difference of a UITableview - fast

How to find the scroll difference of a UITableView. I need to find the difference of scrolling Tableview content from top position of table in swift

I tried the code below,

 func scrollViewDidScroll(_ scrollView: UIScrollView) {
            let contentOffset = tableview.frame.origin.y
            let maximumOffset = (contentOffset - scrollView.contentOffset.y)
            let dif  = maximumOffset
}
+4
source share
2 answers

The offset mapping tableview itself describes the difference between the top of the content and the current current scrollbar.

Try this and see:

print(tableView.contentOffset)

See Apple document for more details - contentOffset

contentOffset : the point at which the start of the content view is offset from the source scroll view.


Also look at this post:

+2
source

A UITableView UIScrollView, contentOffset.

, . /, , . ( , .)

+2

Source: https://habr.com/ru/post/1695764/


All Articles