简体   繁体   中英

UIView Linear Animation Moving View

My intention is to move a UIView Object.

The Code I use for this is:

[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)];

        } ...

But as is the example shown the view is linear moved to the new x position. Is it possible to say that the Animation should go with a step of 20 points for example more and more to the left? So for example: startX = 0; 1. = -20; 2. = -40; . . .

There are several ways to customize the animation curves. The easiest is to pass in one of these to your existing function: https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/UIView/UIView.html#jumpTo_153

Otherwise, you can setup your own animation using keyframes as in this example: https://github.com/ShinobiControls/iOS7-day-by-day/blob/master/11-uiview-keyframe-animation/11-uiview-keyframe-animation.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM