大家早上好,
我对这个问题感到很困惑。
我有3个UIWebViews,应该讨论的是webView1淡入(有效)淡出和WebView2淡入......
到目前为止,我做到了:
CATransition *Animation = [CATransition animation];
[Animation setDuration:4.0];
[Animation setType:kCATransitionFade];
[Animation setSubtype:kCATransitionFade];
[Animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
transitioning = YES;
if (transitioning) {
[self.webView1.layer addAnimation:Animation forKey:nil];
self.webView1.hidden = YES;
self.webView2.hidden = NO;
任何人都可以帮助我吗?
当它在webView中消失时,即使背景颜色设置为另一种颜色,也会从白色渐弱! 我不能影响颜色吗?
答案 0 :(得分:3)
您应该使用UIView
隐式动画。例如,从webView1到webView2的交叉淡入淡出:
[UIView beginAnimations:@"fade" context:nil];
self.webView1.alpha = 0.0;
self.webView2.alpha = 1.0;
[UIView commitAnimations];
如果你想在动画结束后执行一些代码,请在begin和commit之间插入:
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(fadeAnimationDidStop:finished:context:)];
并使用签名
创建didStop方法- (void)fadeAnimationDidStop:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context`
答案 1 :(得分:1)
transition.type =kCATransitionMoveIn;
transition.subtype =kCATransitionFade;