【发布时间】:2018-01-02 11:46:03
【问题描述】:
现有的 CGAffineTransform 可以很好地完成这项工作,但它只在其中心点旋转。我想在其左上角坐标中旋转 UIView,
轮换代码:
// here rectangle is UIView
rectangle.transform = CGAffineTransform(rotationAngle: 90.degreesToRadians)
扩展:
// use to convert degree to radian
extension BinaryInteger {
var degreesToRadians: CGFloat { return CGFloat(Int(self)) * .pi / 180 }
}
我在建议的问题中找不到我的答案。
【问题讨论】:
-
@the4kman 你能告诉我它是如何工作的吗?