Step 0:Download the utility class and drag it into the project

Github.com/zhYes/Anima…

Step 1: Import the header file

# import "LYQuestionsOneAnimationTrasition. H" / / / set properties @ property LYQuestionsOneAnimationTrasition * (nonatomic, strong) animatedTransition;Copy the code

Step 2: Set up the proxy

/ / 1. Set the agent self. AnimatedTransition = [[LYQuestionsOneAnimationTrasition alloc] init]; self.navigationController.delegate = self.animatedTransition;Copy the code

Step 3: Set parameters to complete the jump

GWMCarSourceTableViewCell * cell = (GWMCarSourceTableViewCell *)[self.carListTableView cellForRowAtIndexPath:indexPath];  CGRect imgFrame = [self getFrameInWindow:cell.carImageView]; / / 2. The incoming necessary three parameters [self. AnimatedTransition setTransitionImgView: cell. CarImageView]; / / transition animation imageView [self animatedTransition setTransitionBeforeImgFrame: imgFrame]; / / transition imageView frame before [the self animatedTransition setTransitionAfterImgFrame: CGRectMake (0, 0, k_SCREEN_WIDTH, K_SCREEN_WIDTH * (275.0/375.0))]; / / imageView frame / / 3. After the transition push jump GWMCarDetailBaseViewController * carDetail = [[GWMCarDetailBaseViewController alloc] init]; [self.navigationController pushViewController:carDetail animated:YES];Copy the code

Add a method used:

- (CGRect)getFrameInWindow:(UIView *)view {return [view.superView convertRect:view.frame toView:nil]; }Copy the code


The above effect has been completed



beautify

[self performSelector:@selector(delayMethods) withObject:nil afterDelay:0.25]; / / need to use animated transitions / / 2. The patterns of the picture is set to best UIViewContentModeScaleAspectFit [cell. CarImageView setContentMode:UIViewContentModeScaleAspectFit]; //3.A->B B->C if only B->C is implemented and B->A is not used add: - (void)viewWillAppear:(BOOL)animated { if ([self.navigationController.childViewControllers.lastObject isKindOfClass:[self class]]) { self.navigationController.delegate = nil; //pop does not use excessive animation} [super viewWillAppear:animated]; }Copy the code

Principle explanation reference: iOS custom interactive transfer animation – imitation wechat picture transfer, cool dog transfer (from zero to one + interactive picture browser)