gpt4 book ai didi

ios - 为什么不调用 UIViewControllerTransitioningDelegate 的 presentationControllerForPresentedViewController 方法?

转载 作者:可可西里 更新时间:2023-11-01 04:08:11 25 4
gpt4 key购买 nike

我想使用自定义 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 没有调用!

为什么?

最佳答案

仅当您使用 UIModalPresentationCustom 呈现样式呈现 View Controller 时才会调用它

关于ios - 为什么不调用 UIViewControllerTransitioningDelegate 的 presentationControllerForPresentedViewController 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26504752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com