【问题标题】:Scaling from the center UIImageView从中心 UIImageView 缩放
【发布时间】:2013-01-16 19:24:21
【问题描述】:

所以我一直在寻找这个解决方案,但没有看到任何我正在寻找的东西。这个问题似乎是正确的想法,但答案不起作用:Here。我觉得有一个我找不到的超级简单的答案。

无论如何,我有一个 UIImageView,当我尝试使用时

[UIView animateWithDuration:0.5
                 animations:^
         {
             uv.transform = CGAffineTransformMakeScale(1.1,1.1);
         }
                 completion:^(BOOL finished)
         {
             [UIView animateWithDuration:0.5
                              animations:^
                              {
                                  uv.transform = CGAffineTransformMakeScale(1.0,1.0);
                              }];
         }
];

图像从左上角缩放(即向下和向右延伸)。我希望它向各个方向延伸,而不仅仅是两个方向。我认为这与boundscenter 或其他UIImageView 特征有关。

【问题讨论】:

    标签: ios uiimageview scaling


    【解决方案1】:

    在动画前后设置view.center。

    【讨论】:

    • view.center 设置为究竟是什么?给CGPointMake(uv.bounds.size.width/2, uv.bounds.size.height/2)CGPointMake(uv.frame.size.width/2, uv.frame.size.height/2),还有别的吗?
    • 到动画前后的位置。这可能是 super.view.center,你懂的
    • 当我这样做时,它只是移动视图的位置,它对缩放没有影响。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-23
    • 2011-09-20
    • 2012-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-01
    相关资源
    最近更新 更多