此answer添加一个WKUserScript
的实例以将scalesPageToFit
的值设置为true
,但是我需要创建两个启用和禁用scalesPageToFit
的方法。
启用已在该帖子中得到解答,但我需要知道如何禁用它。
检查框架,我设法为WKUserContentController
调用方法以删除所有关联的用户脚本。 WKUserContentController
对象为JavaScript提供了一种将消息发布到Web视图的方法(Documentation)
- (void) disableZoom {
[self.webview.configuration.userContentController removeAllUserScripts];
}