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

首頁 > 系統(tǒng) > iOS > 正文

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

2019-10-21 18:49:22
字體:
供稿:網(wǎng)友

 1.普通動畫:

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

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

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自帶動畫效果的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對VEVB武林網(wǎng)網(wǎng)站的支持!


注:相關(guān)教程知識閱讀請移步到IOS開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 北京市| 大足县| 乾安县| 通山县| 临沂市| 紫金县| 额尔古纳市| 绍兴市| 大冶市| 金坛市| 宁乡县| 白玉县| 云浮市| 寿宁县| 新民市| 永清县| 论坛| 德昌县| 屯昌县| 富阳市| 广宗县| 芷江| 清远市| 左贡县| 侯马市| 通山县| 旺苍县| 景东| 青阳县| 洪雅县| 宝鸡市| 庆城县| 金沙县| 衡南县| 遂川县| 泸州市| 基隆市| 阜南县| 潮安县| 罗平县| 景洪市|