在 Safari View Controller 中隐藏共享选项

Hide share options in Safari View Controller

有什么方法可以隐藏 Safari View Controller 中默认提供的共享选项吗?我试图隐藏 Safari View Controller 默认提供的额外选项,但无法这样做。

如果有人知道这件事,请告诉我。

谢谢!

SFSafariViewController 不适用于自定义。如果您想自定义 Safari 视图控制器的外观和感觉,甚至 Apple 文档也说使用 WKWebView

来自 Apple 文档

Choosing the Best Web Viewing Class

If your app lets users view websites from anywhere on the Internet, use the SFSafariViewController class. If your app customizes, interacts with, or controls the display of web content, use the WKWebView class. When you adopt SFSafariViewController and a user presses a link to peek at and then pop to the link’s destination, the user views web content from within your app. Tapping Done, the user returns to the view controller that was displayed before the web content was loaded. When you instead use the WKWebView class, Peek and Pop sends the user to Safari by default.

另一方面,SFSafariViewController 确实提供了某种 UI 自定义。您只能更改 preferredBarTintColorprefererredControlTintColor。 iOS 11 有一个新选项可以使用 @NSCopying var configuration: SFSafariViewController.Configuration { get } 来设置初始配置,但很遗憾,这对您也没有帮助