I'm using table view custom cell in my application in swift language.I am performing scaling animation for cell while scrolling up and down. I need to detect whether the cell is fully visible during my scrolling. Can any one help me out regarding this. Thanks in advance.
Asked
Active
Viewed 175 times
-1
-
1Please provide information of what you have tried and where you are having troubles. Your question is just too broad. – Alonso Urbano Jul 19 '16 at 04:43
-
I need to check whether cell at current indexpath is fully visible or not – Venkat_09 Jul 19 '16 at 05:23
-
Show what you have tried so far – Alonso Urbano Jul 19 '16 at 05:25
-
http://stackoverflow.com/questions/9831485/best-way-to-check-if-uitableviewcell-is-completely-visible – Subin K Kuriakose Jul 19 '16 at 05:32
-
use *tableView.rectForRowAtIndexPath(indexPath)* method to get cell rect and see complete rect is withing screen frame. – RJE Jul 19 '16 at 06:20
2 Answers
3
You can use visibleCells
property on UITableView, and check if your cell is there. Check out the apple documentation for UITableView.

OlgaGalchenko
- 46
- 2
0
You can get the rect of a cell with rectForRowAtIndexPath: method and compare it with tableview's bounds rect using CGRectContainsRect function.
Note that this will not instantiate the cell if it is not visible, and thus will be rather fast.
let cellRect = tableView.rectForRowAtIndexPath(indexPath)
let completelyVisible = tableView.bounds.contains(cellRect)

Subin K Kuriakose
- 839
- 7
- 17