I know this must exist but I can't seem to find it. I have a scrollable tableview and I want to find the height of the total tableview beyond the scrollview. In otherwords...the maxY of the last row on that tableview. Anyone know how I can do this?
Reason: I have autodragging feature and I want to stop autodragging when I get to the last item in the table.
Answer or other ideas welcome.
use this method, to get to the last row of tableview
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
let lastElement = dataSource.count - 1
if indexPath.row == lastElement {
// now you are on last item..
}
}
An alternative to using the willDisplayCell
mentioned by Umer Faroq (which should work as well) would be to use the ContentSize
and ContentOffset of the TableView. When the ContentOffset
reaches the ContentSize (or within some buffer you want to use) you'll be at the end of the TableView.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.