刚刚在 swift 3 中研究捏合手势识别器,但无法找出以下错误

just worked on a pinch gesture recognizer in swift 3 and can not figure out the following error

var width: CGFloat = 0
var height: CGFloat = 0
@IBOutlet weak var imageView1: UIImageView!

@IBAction func zoomto(_ sender: UIPinchGestureRecognizer) {

imageView1.frame = CGRect(imageView1.frame.origin.x, imageView1.frame.origin.y, width * sender.scale, height * sender.scale)
  }

显示错误“参数标签'( _ :, _ :, _ :, _ :)'与任何可用重载不匹配

知道需要更改什么来解决这个问题吗

我认为您必须使用有效的 CGRect 构造函数 - 请参阅 the docs here

在你的情况下它会是这样的:

CGRect(x: imageView1.frame.origin.x, y: imageView1.frame.origin.y, width: width * sender.scale, height: height * sender.scale)