LoginSignup
1

More than 5 years have passed since last update.

WKWebViewでPinchZoomを有効にする方法

Last updated at Posted at 2017-09-24

初投稿になります!!
最近AbemaTVのインターンに行き、たくさん学んで田舎に帰ってきたところです。。
帰って来てからMVVMとRxSwiftで自身のアプリを書き直しています。

さて本題ですが、ネット上にWKWebViewの情報が少なかったのと、メモという形で残しておきます。

override func loadView() {
    let webConfiguration = WKWebViewConfiguration()
    webConfiguration.ignoresViewportScaleLimits = true // trueにするとPinchZoomが有効
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    view = webView
}

loadView()でWKWebViewを生成する時のWKWebViewConfiguration()のプロパティで、
ignoresViewportScaleLimits = trueにすればOKです。
AppleのWKWebViewの使い方を参考にしています。

それでは👋

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1