您好,登錄后才能下訂單哦!
基于PhoneGap 2.0.0 源碼,修改 Commands 包下的 CDVSplashScreen 類,使用 Splashscreen的過度效果更自然[漸變透明|左右上下Slide|翻頁],以下代碼只是拋磚引玉,可以利用ios的動畫庫實(shí)現(xiàn)更多的過度動畫。 希望本文能幫助一些孩童學(xué)習(xí)PHONEGAP的用法,更靈活運(yùn)用源碼滿足自己的開發(fā)需求。
- - (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)];
- // 動畫結(jié)束后執(zhí)行隱藏操作
- [UIView setAnimationDidStopSelector:@selector(showAnimationDone:vc:show:finished:context:)];
- ((CDVViewController*)vc).p_w_picpathView.alpha = 0.0;//讓Splashscreen 的填充圖片的透明度漸漸變?yōu)?;
- ((CDVViewController*)vc).activityView.alpha = 0.0; //讓Splashscreen 的活動視圖的透明度漸漸變?yōu)?;
- [UIView commitAnimations];
- }
- }
- }
- //動畫結(jié)束后隱藏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;
- }
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。