这个Swift代码的等效代码是什么?

时间:2017-03-17 10:33:01

标签: objective-c swift

您好我正在尝试使用youtube UI功能实现播放器。我在swift中得到了一个示例代码,所以我将其转换为Objective-C但是我无法转换底部代码行。任何人都可以转换吗?

let scale = CGAffineTransform.init(scaleX: (1 - 0.5 * scaleFactor), y: (1 - 0.5 * scaleFactor))
    let trasform = scale.concatenating(CGAffineTransform.init(translationX: -(self.player.bounds.width / 4 * scaleFactor), y: -(self.player.bounds.height / 4 * scaleFactor)))
    self.player.transform = trasform

1 个答案:

答案 0 :(得分:-1)

我认为这是以下代码,我没有测试过,因为我不知道结果。

CGAffineTransform *scale = CGAffineTransformMakeScale((1 - 0.5 * scaleFactor), (1 - 0.5 * scaleFactor));
CGAffineTransform *scale2 = CGAffineTransformMakeTranslation(-(self.player.bounds.width / 4 * scaleFactor), -(self.player.bounds.height / 4 * scaleFactor));
// concat the 2 CGAffineTransforms. 
CGAffineTransform *transform = CGAffineTransformConcat(scale, scale2);
self.player.transform = transform;