[英]UIView animateWithDuration:delay:options:animate:completion not delaying
我在SO上已经看到了与此相关的一些问题,但是似乎都没有一个答案: UIView
animateWithDuration:delay:options:animate:completion:
的delay
部分不会延迟。 这是调用它的实际代码:
-(void) viewDidAppear:(BOOL)animated
{
NSLog(@"about to start animateWithDuration...");
[UIView animateWithDuration:3.0 delay:2.0 options:UIViewAnimationOptionTransitionNone
animations:^{NSLog(@"in the animations block..."); self.textView.hidden = YES;}
completion:^(BOOL finished){if (finished) {NSLog(@"In the completion block..."); self.textView.hidden = NO; [self.player play];}}];
}
这是NSLog
时间戳:
2013-06-18 15:27:16.607 AppTest1 [52083:c07]即将开始animateWithDuration ...
2013-06-18 15:27:16.608 AppTest1 [52083:c07]在动画块中...
2013-06-18 15:27:16.609 AppTest1 [52083:c07]在完成区块...
可以看到,指令的执行间隔为毫秒,而没有延迟2或3秒。 有人知道原因吗?
hidden
属性不能设置动画:
UIView
类的以下属性是可动画的:
@property frame
@property bounds
@property center
@property transform
@property alpha
@property backgroundColor
@property contentStretch
尝试在动画块中使用这些属性之一,然后应发生延迟。 例如,您可以将alpha
从1.0
为0.0
动画,然后将其隐藏在完成块中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.