簡體   English   中英

UIView線性動畫移動視圖

[英]UIView Linear Animation Moving View

我的意圖是移動UIView對象。

我為此使用的代碼是:

[UIView animateWithDuration:(biggestViewWidth * 0.005) delay:1.0 options:UIViewAnimationOptionCurveLinear animations:^{


            //
            [view setFrame:CGRectMake(0, view.frame.origin.y, view.frame.size.width, view.frame.size.height)];

            // View verschieben
            [view setFrame:CGRectMake(-view.frame.size.width - 10, view.frame.origin.y, view.frame.size.width, view.frame.size.height)];

        } ...

但是,如示例所示,視圖是線性移動到新的x位置的。 可以說動畫應該向左移動20點,例如越來越多嗎? 例如:startX = 0; 1. = -20; 2. = -40;

有幾種自定義動畫曲線的方法。 最簡單的方法是將其中之一傳遞給您現有的函數: https : //developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/UIView/UIView.html#jumpTo_153

否則,您可以像以下示例一樣使用關鍵幀設置自己的動畫: https : //github.com/ShinobiControls/iOS7-day-by-day/blob/master/11-uiview-keyframe-animation/11-uiview-keyframe -animation.md

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM