evgenyneu / Cosmos

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

How to change rating by tapping, not by dragging? #156

Open yeonpark333 opened 4 years ago

yeonpark333 commented 4 years ago

I am trying to make my star rating get the rate by tapping, not by dragging for user experience. But I cannot find any code for this. Is there anyone who can help me? Thank you in advance!

evgenyneu commented 4 years ago

Hi @yeonpark333, thanks for reporting, it must be a bug in Cosmos because tapping should change the stars see demo app.

yeonpark333 commented 4 years ago

Is it because i put the cosmos in collectionview?

evgenyneu commented 4 years ago

Probably, the demo app includes a screen with Cosmos in a table view, which is similar to collection view.

Have you tried this:

https://github.com/evgenyneu/Cosmos/wiki/Using-Cosmos-in-a-scroll-view

djdance commented 2 years ago

to make it work in tableview, simply add this in cell

let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dummy))
        gestureRecognizer.cancelsTouchesInView = false
        addGestureRecognizer(gestureRecognizer)