iOS12: transitionController устарел - PullRequest
1 голос
/ 13 марта 2019

У меня есть приложение на основе 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)
}

1 Ответ

4 голосов
/ 13 марта 2019

Я считаю, что параметр был только что изменен, и вы можете просто заменить forDocumentURL на forDocumentAt:

let transitioningController = transitionController(forDocumentAt: documentURL)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...