LoginSignup
4
4

More than 5 years have passed since last update.

iOSアプリ等でwebviewを表示する際に、拡大はするがユーザーがピンチで拡大や、スクロールができないようにする。

Last updated at Posted at 2015-11-11

iphoneアプリ等で、webviewを部分的に表示する際に、
そのwebviewのサイズにフィットさせてhtmlを表示したい場合。

かつ、ピンチイン・アウトでhtmlを拡縮したりスクロールできないようにしたい場合。

アプリ側

_webView.scalesPageToFit = YES;

webview側にscalesPageToFitで自動フィット&ピンチイン・アウト等が可能に。

次にhtml側

<html>
<head>
<meta name='viewport' content='width=device-width,user-scalable=no' />
</head>
<body>

user-scalable=noでユーザーの操作を受け付けないようにする!!

以上。
参考になれば幸いです!

4
4
0

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
4
4