evgenyneu / Cosmos

A star rating control for iOS/tvOS written in Swift
MIT License
2.18k stars 366 forks source link

Tap gesture recognizer messes up Cosmos #190

Closed ksignorini closed 2 years ago

ksignorini commented 2 years ago

I am using cosmos in a static table view cell.

Some other cells in the static table view require text input, so I launch a keyboard. To clear the keyboard I’ve added a tap gesture recognizer to the entire table view.

When I do that, Cosmos stops working properly.

Is there a way to make both work together?

Thanks!

ksignorini commented 2 years ago

Turns out, I needed to declare my tap gesture recognizer like this (the cancelsTouchesInView was the key):

let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)
tap.cancelsTouchesInView = false

Works now.