How to move the uiview from left to right and vice versa

前端 未结 5 1118
自闭症患者
自闭症患者 2021-01-01 05:43

Hi I am developing one application.In that i did the animation for one view to move from left to right and right to left and changing the values for labels contained in that

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 05:51

    try this

    First clik L to R

         CGRect basketTopFrame = Yourview.frame;
             basketTopFrame.origin.x = 115;
         [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ Yourview.frame = basketTopFrame; } completion:^(BOOL finished){ }];
    

    then R To L

        CGRect napkinBottomFrame = Yourview.frame;
         napkinBottomFrame.origin.x = 0;
         [UIView animateWithDuration:0.3 delay:0.0 options: UIViewAnimationOptionCurveEaseOut animations:^{ Yourview.frame = napkinBottomFrame; } completion:^(BOOL finished){/*done*/}];
    

提交回复
热议问题