我想使用自定义 UIPresentationController。为此,当我想显示新场景时,我调用此代码
UIViewController *cv = [[...]];
cv.transitionManager=[[MyTransition alloc] init];
cv.transitioningDelegate=actionSheet.transitionManager;
cv.modalTransitionStyle = UIModalPresentationCustom;
[self presentViewController:cv animated:YES completion:^{
}];
我的过渡经理有方法:
#pragma mark - UIViewControllerTransitioningDelegate
- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
return self;
}
- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{
return self;
}
- (id <UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id <UIViewControllerAnimatedTransitioning>)animator{
return nil;
}
- (id <UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator{
return self;
}
- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source {
MyPresentationController *presentationController = [[MyPresentationController alloc] initWithPresentedViewController:presented presentingViewController:presenting];
return presentationController;
}
但是方法presentationControllerForPresentedViewController 没有调用!
为什么?