基于PhoneGap 2.0.0 源码,修改 Commands 包下的CDVSplashScreen 类,使用 Splashscreen的过度效果更自然[渐变透明|左右上下Slide|翻页],以下代码只是抛砖引玉,可以利用ios的动画库实现更多的过度动画。 希望本文能帮助一些孩童学习PHONEGAP的用法,更灵活运用源码满足自己的开发需求。

-(void)__show:(BOOL)show{//Legacysupport-oncedeprecatedclassesremoved,cleanthisupid<UIApplicationDelegate>delegate=[[UIApplicationsharedApplication]delegate];if([delegaterespondsToSelector:@selector(viewController)]){idvc=[delegateperformSelector:@selector(viewController)];if([vcisKindOfClass:[CDVViewControllerclass]]){[UIViewbeginAnimations:nilcontext:nil];[UIViewsetAnimationDuration:0.9];[UIViewsetAnimationTransition:UIViewAnimationTransitionNoneforView:((CDVViewController*)vc).viewcache:YES];[UIViewsetAnimationDelegate:((CDVViewController*)vc)];       //动画结束后执行隐藏操作[UIViewsetAnimationDidStopSelector:@selector(showAnimationDone:vc:show:finished:context:)];((CDVViewController*)vc).p_w_picpathView.alpha=0.0;//让Splashscreen的填充图片的透明度渐渐变为0;((CDVViewController*)vc).activityView.alpha=0.0;//让Splashscreen的活动视图的透明度渐渐变为0;[UIViewcommitAnimations];}}}//动画结束后隐藏Splashscreen-(void)showAnimationDone:(id*)viewControllershowOrhide:(BOOL)showanimationID:(NSString*)animationIDfinished:(NSNumber*)finishedcontext:(void*)context{((CDVViewController*)viewController).p_w_picpathView.hidden=!show;((CDVViewController*)viewController).activityView.hidden=!show;}