UIView Animation Doesn't Work on Back Button Click

I have a 2 View controller. The first view controller contained 1 uiview with animation after starting the view controller and a Continue button. The second view controller contains only one button, which is the Back button.

Situation:

when click execute the uiview animates nicely, then go to the controller of the second view. when clicking the back button on the second view controller and firing it and returning to the 1st view controller, uiview no longer animates.

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [self.MainV setFrame:CGRectMake(10,370, 285, 73)];
    [UIView commitAnimations];
}

      

+3


source to share


1 answer


Have you ever reset the MainV frame from where it started? After the view has been animated in place once, it will stay there. Perhaps you want to move MainV to a different location in the method -UIViewController viewDidDisappear]

? You can set the view frame there so that it reanimates every time the view opens.



0


source







All Articles