淡入淡出视图IN和OUT

大家,早安,

我完全同意这个问题。

我有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淡入淡出,即使背景颜色设置为其他颜色! 我不能影响颜色?

你应该使用UIView隐式animation。 例如,从webView1到webView2的淡入淡出:

 [UIView beginAnimations:@"fade" context:nil]; self.webView1.alpha = 0.0; self.webView2.alpha = 1.0; [UIView commitAnimations]; 

如果要在animation完成后执行一些代码,请在开始和提交之间插入:

 [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(fadeAnimationDidStop:finished:context:)]; 

并用签名创builddidStop方法

 - (void)fadeAnimationDidStop:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context` 
 transition.type =kCATransitionMoveIn; transition.subtype =kCATransitionFade;