在我的一个 View 中,我需要为 UIImageView 的框架属性设置动画,同时我想在导航栏的标题 View 中显示进度条 (UIProgressView)。问题是如果我注释掉以下内容动画阻止进度条按预期顺利更新。另一方面,由于以下动画,进度条在多个位置停止并再次递增。
//add message bubble
[UIView animateWithDuration:0.3
delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^
{
animationBubbleImageView.alpha = 1;
}
completion:^(BOOL finished)
{
[self removeAutoCorrectionAndHighlight];
[UIView animateWithDuration:0.3
delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^
{
CGRect bubbleFrame = CGRectMake(animationBubbleImageView.frame.origin.x,
animationBubbleImageView.frame.origin.y,
bubbleSize.width,
bubbleSize.height);
[animationBubbleImageView setFrame:bubbleFrame];
messageLabel.alpha = 1;
}
completion:^(BOOL finished)
{
[self sendSubviewToBack:textView];
[self.delegate moveBubbleToTableCell];
}];
}];
动画 block 不会阻塞主线程,但是进度 View 不流畅的原因可能是什么?
更新:我想要实现的是 IOS 中的 MessagesApp 气泡动画。当键入的消息变成气泡并飞到它的位置时,进度条应该缓慢增加。
如果我在没有动画进度条正常增加的情况下尝试同样的事情。
最佳答案
尝试把进度条动画和气泡动画放在同一个动画里。或者把他们都放到一个动画组里。
关于iphone - 动画持续时间 : corrupts smooth progressbar increment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14564761/