我在SO看过几个与此相关的问题,但他们都没有回答这个问题:delay
部分UIView
animateWithDuration:delay:options:animate:completion:
不会延迟。下面是调用它的实际代码:UIView animateWithDuration:delay:options:animate:completion not undelaying
-(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年6月18日15:27:16.607 AppTest1 [52083:C07]即将开始animateWithDuration。 ..
2013年6月18日15:27:16.608 AppTest1 [52083:C07]在动画块...
2013年6月18日15:27:16.609 AppTest1 [52083:C07在完成块...
正如人们可以看到的那样,指令的执行时间为毫秒,而不是延迟2或3秒。有人会知道这个原因吗?
感谢您的快速回复!我也通过不使用animateWithDuration完成了工作:完全可以使用[self performSelector:@selector(doneMethod)withObject:nil afterDelay:0.5]; – user2491253