国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS自帶動畫效果的實例代碼

2020-07-26 03:00:22
字體:
來源:轉載
供稿:網友

 1.普通動畫:

[UIView beginAnimations:nil context:nil];[UIView setAnimationDuration:2];frame.origin.x += 150;[img setFrame:frame];[UIView commitAnimations];

2.連續動畫(一系列圖像):

NSArray *myImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"myImage1.png"],[UIImage imageNamed:@"myImage2.png"],[UIImage imageNamed:@"myImage3.png"],[UIImage imageNamed:@"myImage4.png"], nil];UIImageView *myAnimatedView = [[UIImageView alloc] initWithFrame:[self bounds]];myAnimatedView.animationImages = myImage;myAnimatedView.animationRepeatCount = 0;[myAnimatedView startAnimating];[self addSubview:myAnimatedView];[my AnimatedView release];

3.CATransition Public API:

CATransition *animation = [CATransition animation];animation.duration = 0.5f;animation.timingFunction = UIViewAnimationCurveEaseInOut;animation.fillMode = KCAFillModeForwards;//各種動畫效果/*KCATransitionFade;KCATransitionMoveIn;KCATransitionPush;KCATransitionReveal;*//*KCATransitionFromeRight;KCATransitionFromLeft;KCATransitionFormTop;kCATransitionFromButtons;*///各種組合animation.type = KCATransitionPush;animation.subtype = KCATransitionFromRight;[self.view.layer addAnimation:animation forKey:@"animation"];

4.UIView Animations動畫:

[UIView beginAnimations:@"animationID" context:nil];[UIView setAnimationDuration:0.5f];[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];[UIView setAnimationRepeatAutoreverses:NO];//以下四種效果/*[UIView setAnimationTransition:UIViewAnimationTransitionFlipFormLeft forView:self.view cache:YES];[UIView setAnimationTransition:UIViewAnimationTransitionFlipFormRight forView:self.view cache:YES];[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];*/

5.嵌套使用,先變大再消失

[UIView animateWithDuration:1.25 aniamtions:^{    CGAffineTransform newTRansform = CGAffineTransformMakeScale(1.2, 1.2);    [firstImageView setTransform:newTransform];    [secondImageView setTransform:newTransform];    completion:^(BOOL finished){        [UIView animateWithDuration:1.2 animations:^{            [firstImageView setAlpha:0];            [secondImageView setAlpha:0];        }        completion:^(BOOL finished){            [firstImageView removeFromSuperview];            [secondImageView removeFromSuperview];        }        ];    }];

以上所述是小編給大家介紹的iOS自帶動畫效果的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广宗县| 额敏县| 美姑县| 武陟县| 论坛| 渭源县| 汪清县| 大同市| 通渭县| 马公市| 玉田县| 泸定县| 民勤县| 克什克腾旗| 平湖市| 崇阳县| 龙山县| 秭归县| 弥勒县| 隆回县| 黔江区| 昌吉市| 克东县| 无锡市| 元朗区| 苗栗市| 定州市| 沛县| 资溪县| 富源县| 礼泉县| 神池县| 将乐县| 康平县| 军事| 湟源县| 宜丰县| 永州市| 屏东县| 凌海市| 张家港市|