【问题标题】:Applying two consecutive transformations on a UIView在 UIView 上应用两个连续的转换
【发布时间】:2015-08-19 02:40:21
【问题描述】:

如何对视图应用缩放和旋转变换?当我使用下面的代码时,只应用了最后一个转换。

testV.transform = CGAffineTransformRotate(view.transform, keepRotation)
testV.transform = CGAffineTransformScale(view.transform, keepScale, keepScale)

【问题讨论】:

    标签: swift transform


    【解决方案1】:

    让它像这样工作:

    var transformation1 = CGAffineTransformRotate(view.transform, keepRotation)
    var transformation2 = CGAffineTransformScale(view.transform, keepScale, keepScale)
    
    testV.transform = CGAffineTransformConcat(transformation1, transformation2)
    

    【讨论】:

    • 为什么您要在很短的时间内提出和回答自己的问题?
    • 如果您在 3 分钟内有答案,请先尝试解决。
    猜你喜欢
    • 1970-01-01
    • 2018-05-31
    • 1970-01-01
    • 2018-12-13
    • 2011-07-27
    • 2010-11-09
    • 2013-05-08
    • 1970-01-01
    • 2011-02-22
    相关资源
    最近更新 更多