国产探花免费观看_亚洲丰满少妇自慰呻吟_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自帶動畫效果的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 内黄县| 盱眙县| 商南县| 陆河县| 涿州市| 正镶白旗| 凤阳县| 石景山区| 涿鹿县| 利辛县| 潍坊市| 铅山县| 南江县| 衢州市| 林芝县| 高青县| 乳源| 宜宾市| 新泰市| 高邑县| 九寨沟县| 临安市| 阳新县| 靖西县| 通州区| 高邮市| 常熟市| 巫山县| 揭西县| 年辖:市辖区| 邮箱| 寻甸| 邳州市| 鸡泽县| 全州县| 水富县| 岐山县| 喜德县| 景宁| 光泽县| 遂昌县|