0
[UIView animateWithDuration:1 animations:^{
    self.animateView.frame = CGRectMake(100, 100, 50, 50);
} completion:^(BOOL finished) {
    if (finished) {
        NSLog(@"animation finished");
    }
}];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
NSLog(@"after runUntilDate");

像上面这么多代码,这是为什么呢?如果我评论 runUntilDate 行会发生什么?

更新:如果我在最后一行添加下一行(NSLog),直到动画完成才会执行。看起来 runUntilDate 阻塞了主线程,那么为什么我们需要在这里阻塞线程呢?

4

1 回答 1

0

在你的情况下,我认为,什么都没有。看这里

于 2017-05-15T13:30:46.427 回答