如何同时翻转和旋转标签?

How do I flip and rotate a label at the same time?

所以我已经在这个项目上工作了一段时间,它需要我旋转和翻转标签。

这是我的资料:

@IBAction func Flip(_ sender: Any) {
    UIView.animate(withDuration: 2.0,animations: {
        self.timeLabel.transform = CGAffineTransform(scaleX: -1, y: 1)
        self.timeLabel.transform = CGAffineTransform(rotationAngle: (-90 * .pi / 180.0)

我希望当我点击按钮时标签翻转(镜像)然后旋转"Flip",但模拟器中的结果只是旋转,而不是翻转。

如果有人可以为我重写这段代码,那么它就可以做到这两点了。我是新手,看来这个项目需要一段时间。

正如@rmaddy 所建议的那样,分别准备两个转换,将它们连接在一起,最终创建一个转换,然后分配它看起来像

let flipping = CGAffineTransform(scaleX: -1, y: 1)
let rotating = CGAffineTransform(rotationAngle: (-90 * .pi / 180.0)
let fullTransformation = flipping.concatenating(rotating)
self.timeLabel.transform = fullTransformation

有关 concatenating 的更多信息,请查看以下文档 https://developer.apple.com/documentation/coregraphics/cgaffinetransform/1455996-concatenating