ios - 为什么 `viewWillAppear` 将 `animated` 设置为 true,即使在呈现 `present(_, animated: false, _)` 时也是如此?

标签 ios swift cocoa-touch uiviewcontroller

所以我展示了一些 View Controller (从 xib 加载)

let popup = PopupViewController()
popup.configure(withDataSource: dataSource)
vc.present(popup, animated: false, completion: nil)

如您所见,我要求在没有动画的情况下呈现它。但是,呈现的 View Controller 中 viewWill\DidAppear 中的 animated 标志设置为 true

enter image description here

我是不是弄错了什么? 谢谢。

最佳答案

呈现 viewcontroller 是从一个 vc 到另一个 vc 的 vc 转换,viewWillAppear:animated 是将要显示的 View 动画。


根据 Apple 文档:

如果 View Controller 由弹出框内的 View Controller 呈现,则在呈现的 Controller 被关闭后,不会在呈现的 View Controller 上调用此方法。

Source

关于ios - 为什么 `viewWillAppear` 将 `animated` 设置为 true,即使在呈现 `present(_, animated: false, _)` 时也是如此?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45861348/

相关文章:

ios - 在 UIImageView 中显示交错(逐行)图像

ios - 获取 iOS 上 VoiceOver 的当前速度

ios - 如何通过 iOS 8 中提供的新 API 在 iPhone 6 上使用气压计?

ios - 我可以在 UITextField 上设置插入点吗

swift - 使用 Apple 的新注释图钉 Logo 更改注释图钉的颜色

objective-c - 分离由 CGWindowListCopyWindowInfo 返回的真实和虚拟窗口

iphone - 强制隐藏键盘/resignFirstResponder

ios - 删除 Realm 对象后更新 UICollectionView

ios - RestKit 0.20 和 ManagedObjectContexts

ios - 在 Swift 4 中检查本地文件大小