gpt4 book ai didi

swift - iOS12 : transitionController was deprecated

转载 作者:行者123 更新时间:2023-12-01 06:15:06 24 4
gpt4 key购买 nike

我有一个基于 UIDocumentBrowser 的应用程序,它可以打开特定类型的文件。打开文件的默认过渡是从底部滑动,这不是用户可以期望的最好的过渡。在 iOS 12 之前,您可以获得缩放过渡,它现在也可以工作,但编译器提示使用已弃用的 transitionController(forDocumentURL:)。我怎样才能以 iOS 12 的方式实现这种效果?

func presentDocument(at documentURL: URL) {
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let documentViewController = storyBoard.instantiateViewController(withIdentifier: "MainViewController") as! MainViewController
documentViewController.document = Document(fileURL: documentURL)
//
documentViewController.transitioningDelegate = self
let transitioningController = transitionController(forDocumentURL: documentURL)
transitioningController.targetView = documentViewController.view
self.transitioningController = transitioningController
//
present(documentViewController, animated: true, completion: nil)
}

最佳答案

我相信参数刚刚更改,您可以将 forDocumentURL 替换为 forDocumentAt :

let transitioningController = transitionController(forDocumentAt: documentURL)

关于swift - iOS12 : transitionController was deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55146930/

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