'How can I get CGRect of tapped rectangle in ScrollView? [duplicate]
Solution 1:[1]
If you have added UITapGestureRecognizer in every view then you can get the tapped view frame as -
@objc func tapFunction(gesture: UITapGestureRecognizer) {
let viewFrame = gesture.view.frame
let height = viewFrame.height //for height
}
You need to add gesture in every view with a parameter.
let tap = UITapGestureRecognizer(target: self, action: #selector(tapFunction(gesture:)))
yourView.addGestureRecognizer(tap)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Imran0001 |

