Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UIView.animate-->;无法转换值_Uiview - Fatal编程技术网

UIView.animate-->;无法转换值

UIView.animate-->;无法转换值,uiview,Uiview,我的代码没有给我一个错误,因为“无法将类型为'()->Void'的值转换为预期的参数类型'((Bool)->Void)?”,您能帮我指出它吗 UIView.animate(withDuration: 0.2, animations: { () -> Void in sender.transform = CGAffineTransform.identity.scaledBy(x: 2.0, y: 2.0) }, completion: {() -&g

我的代码没有给我一个错误,因为“无法将类型为'()->Void'的值转换为预期的参数类型'((Bool)->Void)?”,您能帮我指出它吗

 UIView.animate(withDuration: 0.2, animations: { () -> Void in
            sender.transform = CGAffineTransform.identity.scaledBy(x: 2.0, y: 2.0)
        }, completion: {() -> Void in
            sender.transform = CGAffineTransform.identity.scaledBy(x: 1.0, y: 1.0)
        })

完成块需要一个布尔值来确定错误是什么,请使用

UIView.animate(withDuration: 0.2, animations: { () -> Void in
            sender.transform = CGAffineTransform.identity.scaledBy(x: 2.0, y: 2.0)
        }) { (_) in
            sender.transform = CGAffineTransform.identity.scaledBy(x: 1.0, y: 1.0)
        }