UIDropDown
UIDropDown copied to clipboard
Selection not working
When the UIDropDown is put with another custom class in a view controller, the selection (didSelectRowAt indexPath) fails to work. In the showTable() function, I added
var tap = UITapGestureRecognizer(target: self, action: #selector(self.didTap))
table.addGestureRecognizer(tap)
and added the following function:
func didTap(onTableView recognizer: UIGestureRecognizer) {
var tapLocation: CGPoint = recognizer.location(in: table)
var indexPath: IndexPath? = table.indexPathForRow(at: tapLocation)
if indexPath != nil {
//we are in a tableview cell, let the gesture be handled by the view
recognizer.cancelsTouchesInView = false
print(indexPath)
}
}