问题描述
在 TwUI
中,在 TUIView $ c>上有一个名为
redraw
的方法$ c>。它强制视图重绘,但它也带来了新的视图状态之间的自由褪色动画。
In TwUI
, there is a method called redraw
on TUIView
. It forces the view to redraw, but it also comes with a free fading animation between the old and new state of the view.
我想知道如果这样的东西可能在正常 UIView
中。基本上,如何在旧状态和新状态之间重新绘制视图( setNeedsDisplay
)?
I'm wondering if something like that is possible in a normal UIView
. Basically, how can I redraw the view (setNeedsDisplay
) with a fading animation between the old and the new states?
推荐答案
使用使用
+ [UIView transitionWithView:duration:options:animations:complete:]
code>选项,并在动画块中强制视图的图层立即重绘其内容。
Use +[UIView transitionWithView:duration:options:animations:completion:]
with the UIViewAnimationOptionTransitionCrossDissolve
option, and inside the animation block, force the view's layer to redraw its contents immediately.
[myView setNeedsDisplay];
[UIView transitionWithView:myView duration:1
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
[myView.layer displayIfNeeded];
} completion:nil];
这篇关于使用淡入淡出动画重绘一个UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!