当 modalPresentationStyle=UIModalPresentationCustom 时不调用 viewDidAppear 和 viewDidDisappear

viewDidAppear and viewDidDisappear not called when modalPresentationStyle=UIModalPresentationCustom

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

除非在演示中未调用 viewDidAppear 和 viewDidDisappear,否则动画是完美的 viewcontroller.This 与 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 时调用这些方法?

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

短篇小说;它隐藏了呈现视图控制器的视图而不是删除它。因此不会调用这些方法。