【问题标题】:uiview rotation keeping 1 coordinate constantuiview旋转保持1坐标不变
【发布时间】:2011-01-30 18:40:08
【问题描述】:

美好的一天!

我想问一下,如果我想将 uiview 放在另一个视图的前面,但我想通过保持它的 1 点不变来实现它,这样看起来只有 1(顶部)部分向下移动。我把我的 uiview 放在 90 度,但我想不出让它水平的方法。这是uiview的代码

clView.frame = CGRectMake(0,100,258,171);
clView.transform = CGAffineTransformIdentity;
clView.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[self.view addSubview:clView];

现在它使我的视野达到 90 度,但我无法通过动画保持一点不变来降低它。像抛射运动。有人可以帮帮我吗?

黄色圆圈部分我想静止,其他移动,90度恢复正常

【问题讨论】:

    标签: objective-c core-animation uiviewanimation image-rotation


    【解决方案1】:

    您可能希望将底层 CALayer 的 anchorPoint 设置为代表黄色圆圈中间的任何坐标。所以像:

    myView.layer.anchorPoint = CGPointMake(x,y); // where x and y is the middle of the yellow circle.
    

    一旦你设置了锚点,就会对该点进行变换。

    This page 对此有更多详细信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-16
      • 2011-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多