Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - UITableView scroll event

I was wondering how to detect if the UITableView is scrolled (up or down). I want to hide the keyboard when the UITableView is scrolled with self.view.endEditing(true).

Thanks in advance

like image 472
Kaaseter Avatar asked May 12 '15 11:05

Kaaseter


2 Answers

You can set property of UITable view (XCode 7+)

In Storyboard:
In Storyboard

in Code:

tableView.keyboardDismissMode = .onDrag 
like image 77
Daniil Chuiko Avatar answered Sep 21 '22 20:09

Daniil Chuiko


You can add UIScrollViewDelegate. After that you can implement scrollViewDidScroll method.

like image 22
ridvankucuk Avatar answered Sep 23 '22 20:09

ridvankucuk