生活随笔
收集整理的這篇文章主要介紹了
优化PhoneGAP的Splashscreen 类
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? 基于PhoneGap 2.0.0 源碼,修改 Commands 包下的?CDVSplashScreen 類,使用 Splashscreen的過度效果更自然[漸變透明|左右上下Slide|翻頁],以下代碼只是拋磚引玉,可以利用ios的動畫庫實現更多的過度動畫。 希望本文能幫助一些孩童學習PHONEGAP的用法,更靈活運用源碼滿足自己的開發需求。
?
-?(void)?__show:(BOOL)show?{?????//?Legacy?support?-?once?deprecated?classes?removed,?clean?this?up?????id<UIApplicationDelegate>?delegate?=?[[UIApplication?sharedApplication]?delegate];??????????if?([delegate?respondsToSelector:@selector(viewController)])?{?????????id?vc?=?[delegate?performSelector:@selector(viewController)];?????????if?([vc?isKindOfClass:[CDVViewController?class]])?{?????????????[UIView?beginAnimations:nil?context:nil];?????????????[UIView?setAnimationDuration:0.9];?????????????[UIView?setAnimationTransition:UIViewAnimationTransitionNone?forView:((CDVViewController*)vc).view?cache:YES];?????????????[UIView?setAnimationDelegate:((CDVViewController*)vc)];? //?動畫結束后執行隱藏操作?????????????[UIView?setAnimationDidStopSelector:@selector(showAnimationDone:vc:show:finished:context:)];?????????????((CDVViewController*)vc).p_w_picpathView.alpha?=?0.0;//讓Splashscreen?的填充圖片的透明度漸漸變為0;?????????????((CDVViewController*)vc).activityView.alpha?=?0.0;?//讓Splashscreen?的活動視圖的透明度漸漸變為0;?????????????[UIView?commitAnimations];?????????}?????}?}??//動畫結束后隱藏Splashscreen?-?(void)?showAnimationDone:(id*)viewController?showOrhide:(BOOL)show?animationID:(NSString?*)animationID?finished:(NSNumber?*)finished?context:(void?*)context?{?????((CDVViewController*)viewController).p_w_picpathView.hidden?=?!show;?????((CDVViewController*)viewController).activityView.hidden?=?!show;?}?
轉載于:https://blog.51cto.com/uppower/984068
總結
以上是生活随笔為你收集整理的优化PhoneGAP的Splashscreen 类的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。