gpt4 book ai didi

ios - 当 modalPresentationStyle=UIModalPresentationCustom 时不调用 viewDidAppear 和 viewDidDisappear

转载 作者:行者123 更新时间:2023-11-28 19:40:44 38 4
gpt4 key购买 nike

我需要做一个自定义演示动画,当我设置这两个 setTransitioningDelegate 和 modalPresentationStyle=UIModalPresentationCustom

除非在呈现的 View Controller 中未调用 viewDidAppear 和 viewDidDisappear,否则动画是完美的。这与 https://developer.apple.com/library/ios/samplecode/LookInside/Introduction/Intro.html 中的 Apple 示例代码相同。

[overlay setTransitioningDelegate:[self transitioningDelegate]];  
overlay.modalPresentationStyle=UIModalPresentationCustom;
[self presentViewController:overlay animated:YES completion:NULL];

为什么在没有给出 modalPresentationStyle 时调用这些方法?

最佳答案

这是正确的行为,因为呈现新的 View Controller 只会隐藏呈现的 View Controller 。当呈现的 View Controller 被关闭时,它不会将 View 添加到层​​次结构中,并且当呈现的 View Controller 呈现时,它不会从层次结构中删除呈现 View Controller View 。

短篇小说;它隐藏了呈现 View Controller 的 View 而不是删除它。因此,不会调用这些方法。

关于ios - 当 modalPresentationStyle=UIModalPresentationCustom 时不调用 viewDidAppear 和 viewDidDisappear,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34517361/

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