開發(fā)過程中常用的關(guān)于函數(shù)有以下幾個(gè):
1.[UIView animateWithDuration: animations:^{} completion:^(BOOL finished) {}];
2.[UIView animateWithDuration: animations:^{}];
3.[UIView animateWithDuration: delay: options: animations: completion:^(BOOL finished) {}];
前兩個(gè)動(dòng)畫的函數(shù)的使用,沒有太多的可講.第三個(gè)動(dòng)畫,多了一個(gè)options選項(xiàng).需要我們傳入一個(gè)枚舉,這個(gè)枚舉主要的作用:當(dāng)前的動(dòng)畫執(zhí)行隨時(shí)間函數(shù)變化(由快變慢,由慢變快等...效果).可以實(shí)現(xiàn)類似淡入淡出的效果.
介紹:
UIViewAniOpinionLayoutSubviews //子視圖中控講將跟父視圖中控件使用相同的動(dòng)畫
UIViewAnimationOptionAllowUserInteraction //動(dòng)畫時(shí)允許用戶交互
UIViewAnimationOpinionBeginFromCurrentState //重當(dāng)前狀態(tài)開始執(zhí)行動(dòng)畫
UIViewAnimationOptionRepeat //動(dòng)畫一直重復(fù)播放
UIViewAnimationOptionAutoreverse //執(zhí)行動(dòng)畫回路,前提是設(shè)置動(dòng)畫無限重復(fù)
UIViewAnimationOptionOverrideInheritedDuration //忽略外層動(dòng)畫嵌套的執(zhí)行時(shí)間
UIViewAnimationOptionOverrideInheritedCurve //忽略外層動(dòng)畫嵌套的時(shí)間變化曲線
UIViewAnimationOptionAllowAnimatedContent //通過改變屬性和重繪實(shí)現(xiàn)動(dòng)畫效果,如果key沒有提交動(dòng)畫將使用快照
UIViewAnimationOptionOverrideInheritedOptions //忽略嵌套繼承的?選項(xiàng)
//時(shí)間函數(shù)曲線相關(guān)
UIViewAnimationOptionCurveEaseInOut //時(shí)間曲線函數(shù),由慢到快
UIViewAnimationOptionCurveEaseIn //時(shí)間曲線函數(shù),由慢到特別快
UIViewAnimationOptionCurveEaseOut //時(shí)間曲線函數(shù),由快到慢
UIViewAnimationOptionCurveLinear //時(shí)間曲線函數(shù),勻速
轉(zhuǎn)場動(dòng)畫它一般是用在這個(gè)方法中的:
[UIView transitionFromView: toView: duration: options: completion:^(BOOL finished) {}];
//相關(guān)的轉(zhuǎn)場動(dòng)畫
UIViewAnimationOptionTransitionNone //無轉(zhuǎn)場動(dòng)畫
UIViewAnimationOptionTransitionFlipFromLeft //轉(zhuǎn)場從左翻轉(zhuǎn)
UIViewAnimationOptionTransitionFlipFromRight //轉(zhuǎn)場從右翻轉(zhuǎn)
UIViewAnimationOptionTransitionCurlUp //上卷轉(zhuǎn)場
UIViewAnimationOptionTransitionCurlDown //下卷轉(zhuǎn)場
UIViewAnimationOptionTransitionCrossDissolve //轉(zhuǎn)場交叉消失
UIViewAnimationOptionTransitionFlipFromTop //轉(zhuǎn)場從上翻轉(zhuǎn)
UIViewAnimationOptionTransitionFlipFromBottom //轉(zhuǎn)場從下翻轉(zhuǎn)