[英]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.