亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        iOS的動畫效果類型及實(shí)現(xiàn)方法

        字號:


            實(shí)現(xiàn)iOS漂亮的動畫效果主要有兩種方法,
            一種是UIView層面的,
            一種是使用CATransition進(jìn)行更低層次的控制,
            第一種是UIView,UIView方式可能在低層也是使用CATransition進(jìn)行了封裝,它只能用于一些簡單的、常用的效果展現(xiàn),這里寫一個常用的示例代碼,供大家參考。
            [UIView beginAnimations:@"Curl"context:nil];//動畫開始
            [UIView setAnimationDuration:0.75];
            [UIView setAnimationDelegate:self];
            [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:myview cache:YES];
            [myview removeFromSuperview];
            [UIView commitAnimations];
            第二種方式相對復(fù)雜一些,但如果更好的進(jìn)行控制,還是使用這種方法吧,
            基本使用方法可以看一下如下例子:
            CATransition *animation = [CATransition animation];
            [animation setDuration:1.25f];
            [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
            [animation setType:kCATransitionReveal];
            [animation setSubtype: kCATransitionFromBottom];
            [self.view.layer addAnimation:animation forKey:@"Reveal"];
            這里使用了setType與setSubtype組合,這使用個比較保險(xiǎn),因?yàn)樗膮?shù)就是官方API里定義的,他們的參數(shù)說明可以參考如下:
            [animation setType:@"suckEffect"];
            這里的suckEffect就是效果名稱,可以用的效果主要有:
            pageCurl 向上翻一頁
            pageUnCurl 向下翻一頁
            rippleEffect 滴水效果
            suckEffect 收縮效果,如一塊布被抽走
            cube 立方體效果
            oglFlip 上下翻轉(zhuǎn)效果
            最后再給出一種常用代碼供大家參考。
            // Curl the image up or down
            CATransition *animation = [CATransition animation];
            [animation setDuration:0.35];
            [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
            if (!curled)
            {
            //animation.type = @"mapCurl";
            animation.type = @"pageCurl";
            animation.fillMode = kCAFillModeForwards;
            animation.endProgress = 0.99;
            } else {
            //animation.type = @"mapUnCurl";
            animation.type = @"pageUnCurl";
            animation.fillMode = kCAFillModeBackwards; animation.startProgress = 0.01;
            }
            [animation setRemovedOnCompletion:NO];
            [view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
            [view addAnimation:animation forKey"pageCurlAnimation"];
            // Disable user interaction where necessary
            if (!curled) {
            }
            else {
            }
            curled = !curled;