【问题标题】:iOS -- How to scale the UIView with left top point?iOS——如何用左上点缩放 UIView?
【发布时间】:2015-08-28 07:51:21
【问题描述】:

我想固定一个点(左上点)并根据点缩放(缩小)UIView

喜欢这张图片

现在我使用self.transform = CGAffineTransformMakeScale( 0.7 , 0.7);来缩放 UIView ,但它只能根据中心点缩放 UIView

编辑

我尝试使用 set anchorPoint with (0,0) 但视图位置错误

【问题讨论】:

标签: ios swift cgaffinetransform


【解决方案1】:

使用锚点属性:

self.layer.anchorPoint = CGPointMake(0.0, 0.0);

【讨论】:

  • 可以使用CGPointZero(同0,0)
【解决方案2】:

尝试设置图层的anchorPoint container!.layer.anchorPoint = CGPoint(x: 0, y: 0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-12
    • 2013-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多