简体   繁体   中英

Preview a view in a table view cell from selecting a row on touch

In my table view cell I have a UIView that shows 5 stars rating. Users can tap it to change the rating. The problem is, when users change the rating the didSelectRow on the table view row is triggered. What is the best way of preventing this? Is there a way to block the UIView from passing the touch events to the table view? I still want the table view cell to be tappable outside the rating view.

1.If you are using buttons in ratting view for ratting?

if yes then increase button size

2.Otherwise you have to increase cell height for ratting view clickable.

I request you to provide screenshot of your tableview and Answer if you are using any library for ratting.

You could override UIResponder 's next property to break the responder chain:

extension CosmosView {
    open override var next: UIResponder? {
        return nil
    }
}

See https://developer.apple.com/documentation/uikit/uiresponder/1621099-next .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM