3

以下是我的代码存在 Safari 视图控制器

 if let url = URL(string: "https://www.ggogle.com.com/") {
            let config = SFSafariViewController.Configuration()
            config.entersReaderIfAvailable = true
            let vc = SFSafariViewController(url: url, configuration: config)
            present(vc, animated: false)


        }

上面的代码调用 viewWillDisappear 但在关闭呈现的视图控制器时不调用 viewWillAppear。

还发现视图被关闭后 viewWillDisappear 根本没有为任何其他 pushViewController 调用

如何解决这个问题?

对此进行更新:

尝试导航控制器并设置其委托并实现以下方法

navigationController:willShowViewController:animated:
navigationController:didShowViewController:animated:

这也不起作用。

更新此尝试以下代码

  vc.modalPresentationStyle = .currentContext

但是使用此标签栏不会隐藏,控制器不会全屏显示,并且目前没有隐藏底栏之类的选项。

4

1 回答 1

0

请试试这个

 if let url = URL(string: "https://www.google.com/") {
            let config = SFSafariViewController.Configuration()
            config.entersReaderIfAvailable = true
            let vc = SFSafariViewController(url: url, configuration: config)

            vc.modalPresentationStyle = .currentContext

            present(vc, animated: false)

        }

更新

vc.modalPresentationStyle = .currentContext
tabBarController?.present(viewController, animated: false, completion: nil)
于 2019-09-07T09:48:37.533 回答