(轉寄)IOS動畫中的枚舉UIViewAnimationOptions

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   color   os   使用   sp   

若本帖轉自(部落格園·小八究):http://www.cnblogs.com/xiaobajiu/p/4084747.html

  可憐目前天朝搜不到什麼有價值的東西方便學習,在這裡方便初學者。

  首先這個枚舉屬於UIViewAnimation。我們經常使用的函數 是 [UIView animateWithDuration: animations:^{} completion:^(BOOL finished) {}];和[UIView animateWithDuration: animations:^{}];如果動畫稍微複雜點,例如需要組合等等就可能用到這個函數:[UIView animateWithDuration: delay: options: animations: completion:^(BOOL finished) {}];剛開始接觸的朋友看到一堆枚舉可能就覺得煩,尤其是蘋果那混亂的動畫架構東一坨,西一坨。又是Quartz2D,又是核心動畫跟臭襪子一樣……沒關係,撿回來接著穿。

  以上方法中的options一項需要傳入一個枚舉,這個枚舉大概控制的是這幾個要素:當前動畫嵌套中的動畫執行隨時間的快慢種類(先快後慢等..)。動畫要一直重複嗎。如果我使用轉場動畫那麼我用哪種轉場效果。還有子動畫嵌套在父動畫中時我們如何對待父動畫中的相同選項等等..

 本文:

    UIViewAnimationOptionLayoutSubviews            //提交動畫的時候布局子控制項,表示子控制項將和父控制項一同動畫。

    UIViewAnimationOptionAllowUserInteraction      //動畫時允許使用者交流,比如觸摸

    UIViewAnimationOptionBeginFromCurrentState     //從目前狀態開始動畫

    UIViewAnimationOptionRepeat                    //動畫無限重複

    UIViewAnimationOptionAutoreverse               //執行動畫迴路,前提是設定動畫無限重複

    UIViewAnimationOptionOverrideInheritedDuration //忽略外層動畫嵌套的執行時間

    UIViewAnimationOptionOverrideInheritedCurve    //忽略外層動畫嵌套的時間變化曲線

    UIViewAnimationOptionAllowAnimatedContent      //通過改變屬性和重繪實現動畫效果,如果key沒有提交動畫將使用快照

    UIViewAnimationOptionShowHideTransitionViews   //用顯隱的方式替代添加移除圖層的動畫效果

    UIViewAnimationOptionOverrideInheritedOptions  //忽略嵌套繼承的選項

   //時間函數曲線相關

    UIViewAnimationOptionCurveEaseInOut            //時間曲線函數,由慢到快

    UIViewAnimationOptionCurveEaseIn               //時間曲線函數,由慢到特別快

    UIViewAnimationOptionCurveEaseOut              //時間曲線函數,由快到慢

    UIViewAnimationOptionCurveLinear               //時間曲線函數,勻速

   //轉場動畫相關的

    UIViewAnimationOptionTransitionNone            //無轉場動畫

    UIViewAnimationOptionTransitionFlipFromLeft    //轉場從左翻轉

    UIViewAnimationOptionTransitionFlipFromRight   //轉場從右翻轉

    UIViewAnimationOptionTransitionCurlUp          //上卷轉場

    UIViewAnimationOptionTransitionCurlDown        //下卷轉場

    UIViewAnimationOptionTransitionCrossDissolve   //轉場交叉消失

    UIViewAnimationOptionTransitionFlipFromTop     //轉場從上翻轉

    UIViewAnimationOptionTransitionFlipFromBottom  //轉場從下翻轉

  以上是淺略的理解,歡迎朋友有更好的指正,以免誤人子弟。

 

 補充:關於最後一組轉場動畫它一般是用在這個方法中的:

    [UIView transitionFromView: toView: duration: options: completion:^(BOOL finished) {}];

 該方法效果是插入一面視圖移除一面視圖,期間可以使用一些轉場動畫效果。

(轉寄)IOS動畫中的枚舉UIViewAnimationOptions

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.