国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 准格尔旗| 河池市| 长海县| 依安县| 尉氏县| 建平县| 五大连池市| 项城市| 东海县| 濮阳县| 阳信县| 新丰县| 康马县| 正定县| 兴义市| 耒阳市| 连城县| 资溪县| 廊坊市| 桂平市| 琼海市| 宁河县| 玉屏| 巨鹿县| 金寨县| 益阳市| 子洲县| 石泉县| 古丈县| 万荣县| 高邑县| 八宿县| 云阳县| 璧山县| 闽清县| 德保县| 汝南县| 晴隆县| 桐柏县| 商城县| 京山县|