【问题标题】:Rotation and Setting center of UIView in animation block doesn't work sometimes动画块中 UIView 的旋转和设置中心有时不起作用
【发布时间】:2014-06-21 06:13:02
【问题描述】:

我想做的是同时旋转和反弹我的UIView。所以目前,我在 UIViewAnimation 块中使用此代码。

[view setTransform:CGAffineTransformRotate(CGAffineTransformIdentity, -M_PI*2)];
CGPoint center = CGPointMake( view.center.x - x , view.center.y - y);
[view setCenter:center];

使用它,它的旋转发生得很好,但视图弹跳没有发生,即根本没有发生任何类型的运动。如果我遗漏了什么,需要指导我在这里做错了什么。

【问题讨论】:

  • 你在使用自动布局吗?
  • 不。我没有使用自动布局。

标签: ios objective-c uiview core-animation uiviewanimation


【解决方案1】:

通过应用旋转和平移来使用变换来做这两件事(注意应用它们的顺序)。当您对视图应用变换时,您不应尝试更改其框架(或中心)。

【讨论】:

    猜你喜欢
    • 2011-07-25
    • 1970-01-01
    • 1970-01-01
    • 2014-10-07
    • 2015-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多