亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時間:2016年12月27日 10:21:56   作者:紹棠  
本文給大家分享ios自帶動畫效果的實現(xiàn)代碼,非常不錯,具有參考借鑒價值,需要的朋友參考下吧

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

相關文章

  • UITableView 實現(xiàn)汽車品牌(demo)

    UITableView 實現(xiàn)汽車品牌(demo)

    UITableView堪稱UIKit里面最復雜的一個控件了,使用起來不算難,但是要用好并不容易,當使用的時候我們必須要考慮到后臺數(shù)據(jù)的設計,tableViewCell的設計和重用以及tableView的效率等問題,下面小編通過UITableView 實現(xiàn)汽車品牌,需要的朋友可以參考下
    2015-08-08
  • iOS內存管理中引用計數(shù)的學習

    iOS內存管理中引用計數(shù)的學習

    文章給大家分享了關于iOS內存管理中引用計數(shù)的相關知識點,對此有需要的朋友可以跟著學習下。
    2018-05-05
  • 10個非常實用的iOS小技巧

    10個非常實用的iOS小技巧

    這篇文章主要為大家詳細介紹了10個非常實用的iOS小技巧,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • iOS自定義UIBarButtonItem的target和action示例代碼

    iOS自定義UIBarButtonItem的target和action示例代碼

    這篇文章主要給大家介紹了關于iOS自定義UIBarButtonItem的target和action的相關資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-02-02
  • iOS開發(fā)之tableView實現(xiàn)左滑刪除功能

    iOS開發(fā)之tableView實現(xiàn)左滑刪除功能

    我們在使用一些應用的時候,在滑動一些聯(lián)系人的某一行的時候,會出現(xiàn)刪除、置頂、更多等等的按鈕,下面這篇文章主要就介紹了iOS用tableView實現(xiàn)左劃刪除功能的方法,有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2017-01-01
  • iOS 控件封裝(又名擰螺絲)之排序按鈕的開發(fā)

    iOS 控件封裝(又名擰螺絲)之排序按鈕的開發(fā)

    排序按鈕是實際開發(fā)中比較常見的一種控件,這篇文章主要介紹了iOS 開發(fā)之排序按鈕,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2018-12-12
  • IOS實現(xiàn)百度地圖自定義大頭針和氣泡樣式

    IOS實現(xiàn)百度地圖自定義大頭針和氣泡樣式

    這篇文章主要介紹了 IOS百度地圖自定義大頭針和氣泡的實例代碼,非常不錯,具有參考借鑒價值,需要的朋友參考下
    2016-12-12
  • iOS開發(fā)之時間戳(或date)轉字符串的實例代碼

    iOS開發(fā)之時間戳(或date)轉字符串的實例代碼

    這篇文章主要介紹了iOS開發(fā)之時間戳(或date)轉字符串的實例代碼,需要的朋友可以參考下
    2017-10-10
  • IOS多線程編程的3種實現(xiàn)方法

    IOS多線程編程的3種實現(xiàn)方法

    這篇文章主要介紹了IOS多線程編程的3種實現(xiàn)方法的相關資料,需要的朋友可以參考下
    2015-11-11
  • iOS App開發(fā)中UIViewController類的使用教程

    iOS App開發(fā)中UIViewController類的使用教程

    UIViewController是iOS中控制視圖的關鍵所在,這里我們將針對UIViewController的聲明周期與主要屬性和方法,來總結iOS App開發(fā)中UIViewController類的使用教程
    2016-07-07

最新評論