Flip animation when controller pushed on iPhone

前端 未结 4 846
失恋的感觉
失恋的感觉 2020-12-23 23:36

I had a look around and didn\'t find what I was exactly looking for.

Is there a way to get a flip animation when pushing a view controller?

I read that you c

4条回答
  •  臣服心动
    2020-12-24 00:29

    - (void)viewWillDisappear:(BOOL)animated {
    [UIView beginAnimations:@"animation2" context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration: 0.7];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
    [UIView commitAnimations]; }
    

    in the new viewcontroller will make it flip back the same way (instead of sliding left) when the back button in the toolbar is pushed -- make sure animation is enabled here, e.g., if you make a custom button to pop the stack, use:

    - (void) backToPrevious: (id) sender 
    {
        //[self.navigationController popViewControllerAnimated:YES];
        [self dismissModalViewControllerAnimated:YES];
    }
    

提交回复
热议问题