Sharad Chauhan
Sharad Chauhan

Reputation: 4891

Can we get which cell was touched based on uiview touch?

I want to know whether I can get which cell was touched depending on the touch or pan location ?

I can get the touch easily but on touch of the view (mostly pan location) I have to reflect changes on the collection view behind it.

For touch location I am doing simple pan gesture like this :

@objc func panButton(pan: UIPanGestureRecognizer) {

        if pan.state == .began {

        } else if pan.state == .ended || pan.state == .failed || pan.state == .cancelled {

        } else {
            let location = pan.location(in: view)

            }
        }
    }

Is this possible ? how ? or any alternative way ?

Upvotes: 0

Views: 38

Answers (1)

kirander
kirander

Reputation: 2256

You need to convert point from one view to another.

Upvotes: 2

Related Questions