我在collectionViewCell的imageView上添加了别针手势。但这行不通。这是我的代码。
cell.imageView.isUserInteractionEnabled = true
let pinGesture = UIPinchGestureRecognizer(target: self, action: #selector(pinGesture(sender:)))
cell.imageView.addGestureRecognizer(pinGesture)
@objc func pinGesture(sender: UIPinchGestureRecognizer) {
sender.view?.transform = (sender.view?.transform.scaledBy(x: sender.scale, y: sender.scale))!
sender.scale = 1.0
}