【问题标题】:Trouble with UIView, animateWithDuration and finishedUIView、animateWithDuration 和完成的问题
【发布时间】:2012-07-14 08:51:53
【问题描述】:

我不知道这段代码有什么问题。

[UIView animateWithDuration:10.0f delay:0.0f options:UIViewAnimationOptionTransitionNone animations:^{
    CGAffineTransform transform = CGAffineTransformMakeScale(0.1, 0.1);
    self.transform = transform;
}
completion:^(BOOL finished) {
    if (finished) { 
        NSLog(@"Animation finished");
        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"NSShowHomeScreen" object:nil ];
    }
}];

即使有 10 秒的持续时间,我也会在动画开始时立即收到控制台消息“动画完成”。

我想缩小/缩放我的第一个 UIView,然后我想显示另一个 UIView。但是现在第二个 UIView 在收缩结束之前就可以很好地显示出来了。

任何帮助将不胜感激。

谢谢

【问题讨论】:

    标签: ios animation uiview


    【解决方案1】:

    对不起,这是我的错。我还使用了导致问题的 UIPinchGestureRecognizer。无论如何感谢您的快速回复..

    谢谢

    【讨论】:

      【解决方案2】:

      在 UIView 文档中,对于 transform 属性,说:

      对此属性的更改可以设置动画。使用 beginAnimations:context: 类方法开始和 commitAnimations 类方法来结束一个动画块。默认 是中心值是什么(或锚点,如果改变了)

      所以也许它不能使用块方法进行动画处理,你将不得不在动画周围使用 begin 和 commit 包装器

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多