presentModalViewController自右向左
阿新 • • 發佈:2018-12-17
When present:
CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromRight; [self.view.window.layer addAnimation:transition forKey:nil]; [self presentModalViewController:viewCtrl animated:NO];
When dismiss:
CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromLeft; [self.view.window.layer addAnimation:transition forKey:nil]; [self dismissModalViewControllerAnimated:NO];
FOR PUSHING THE VIEWCONTROLLER FROM LEFT TO RIGHT:
CATransition* transition = [CATransition animation]; transition.duration = .45; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionMoveIn; transition.subtype= kCATransitionFromLeft; [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; NameViewController *controller = [[NameViewController alloc] init]; [self.navigationController pushViewController:controller animated:NO];
FOR POPPING THE VIEWCONTROLLER FROM RIGHT TO LEFT:
CATransition* transition = [CATransition animation]; transition.duration = .45; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionMoveIn; transition.subtype= kCATransitionFromRight; [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; [self.navigationController popViewControllerAnimated:YES];