Voglio utilizzare UIPresentationController personalizzato. Per quando voglio mostrare nuova scena io chiamo questo codicePerché non chiamare il metodo presentationControllerForPresentedViewController di UIViewControllerTransitioningDelegate?
UIViewController *cv = [[...]];
cv.transitionManager=[[MyTransition alloc] init];
cv.transitioningDelegate=actionSheet.transitionManager;
cv.modalTransitionStyle = UIModalPresentationCustom;
[self presentViewController:cv animated:YES completion:^{
}];
il mio manager di transizione ha metodi:
#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;
}
ma il metodo presentationControllerForPresentedViewController non chiama!
Perché?
lui sta usando UIModalPresentationCustom – litso
@litso davvero. Non so come mi sia mancato e perché la mia risposta sia stata accettata. È possibile che l'autore abbia implementato i metodi UIViewControllerTransitioningDelegate, ma non conforme a questo protocollo. – Silmaril