UIView animateWithDuration: duration: animations: completion: seems to have a default transition?

前端 未结 2 780
说谎
说谎 2021-02-19 07:53

In my program, I want to create an animation that will move at a constant speed. It appears that the animation starts slowly, speeds up and then finishes slowly. Is there any wa

相关标签:
2条回答
  • 2021-02-19 08:48

    You should use, that will solve your problem

    [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveLinear  animations:^{
            //code with animation
        } completion:^(BOOL finished) {
            //code for completion
        }];
    
    0 讨论(0)
  • 2021-02-19 08:56

    You can change this setting by using the animateWithDuration:delay:options:animations:completion: alternative. Send an UIViewAnimationOption mask for the option parameter. These are the options that you're interested in :

     UIViewAnimationOptionCurveEaseInOut 
     UIViewAnimationOptionCurveEaseIn   
     UIViewAnimationOptionCurveEaseOut 
     UIViewAnimationOptionCurveLinear 
    

    The documentation says that UIViewAnimationOptionCurveEaseInOut is the default value.

    See the documentation for more details : http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html

    0 讨论(0)
提交回复
热议问题