Hi, I am developing one application. In that, I made an animation for one view to move left to right and right to left and change the values ββfor the labels contained in this view. But this view is deleted when I click left or the right button and the new view override the old view. Therefore, I do not want to redefine. Just want to add a new look. My code
-(void)centerAnimation1:(id)sender { UIView *currentView = daysview; theWindow = daysview; // set up an animation for the transition between the 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]; } }
I just call the centerAnimation1 method in the right-click action method. After calling this, I changed the label values.
source share