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


hi developing 1 application.in did animation 1 view move left right , right left , changing values labels contained in view.but view removed when click left or right button , new view overriding old view.so don't want overriding.just want add new view.my code

    -(void)centeranimation1:(id)sender      {          uiview *currentview = daysview;             thewindow = daysview;          // set animation transition between views         catransition *animation = [catransition animation];             animation.delegate = self;         [animation setduration:0.4];         [animation settype:kcatransitionmovein];           if(rhtolft)          {              [animation setsubtype:kcatransitionfromleft];          }          else          {              [animation setsubtype:kcatransitionfromright];          }         [animation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]];         [[thewindow layer] addanimation:animation forkey:@"switchtoview1"];             [currentview removefromsuperview];         }           - (void)animationdidstop:(caanimation *)anim finished:(bool)flag{               if(animate)              {                  catransition *animation = [catransition animation];                  animation.delegate = self;                  [animation setduration:0.4];                  [animation settype:kcatransitionmovein];                  if(rhtolft)                  {                      [animation setsubtype:kcatransitionfromleft];                      rhtolft=no;                  }                  else                  {                      [animation setsubtype:kcatransitionfromright];                                  }                  [[thewindow layer] addanimation:animation forkey:@"switchtoview1"];                  animate=no;                  [self.view addsubview:daysview];              }          } 

just call centeranimation1 method in left nad right button action method.after calling one,i changed label values.

try this

first clik l 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 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*/}]; 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -