{"id":1515,"date":"2011-07-05T03:24:16","date_gmt":"2011-07-04T18:24:16","guid":{"rendered":"\/\/do-gugan.com\/~furuta\/index.php\/2011\/07\/05\/uiwebview\/"},"modified":"2011-07-05T03:24:16","modified_gmt":"2011-07-04T18:24:16","slug":"uiwebview","status":"publish","type":"post","link":"https:\/\/do-gugan.com\/~furuta\/archives\/2011\/07\/uiwebview.html","title":{"rendered":"UIWebView\u3092\u30b3\u30fc\u30c9\u3067\u30ba\u30fc\u30e0\u3059\u308b\u65b9\u6cd5\u306e\u899a\u3048\u66f8\u304d"},"content":{"rendered":"<p>iOS\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3067\u3059\u3002<\/p>\n<p>\u30a2\u30d7\u30ea\u5185\u306bWeb\u30d6\u30e9\u30a6\u30b6\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3042\u308bUIWebView\u3092\u57cb\u3081\u8fbc\u3093\u3067\u7c21\u6613\u7684\u306bWeb\u30da\u30fc\u30b8\u3092\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u305d\u306e\u8868\u793a\u500d\u7387\u3092\u76f4\u63a5\u5236\u5fa1\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u6d77\u5916\u306e\u63b2\u793a\u677f\u3082\u542b\u3081\u3066\u7d50\u69cb\u8cea\u554f\u306f\u51fa\u3066\u305f\u3093\u3067\u3059\u304c\u3001\u6709\u7528\u306a\u56de\u7b54\u306f\u5f97\u3089\u308c\u305a\u3002<\/p>\n<p>\u307e\u305a\u6563\u898b\u3055\u308c\u305f\u306e\u306fUIScrollView\u306e\u4e0a\u306bUIWebView\u3092\u7f6e\u3044\u3066\u3001UIScrollView\u5074\u3067\u30d4\u30f3\u30c1\u3084\u30b9\u30af\u30ed\u30fc\u30eb\u3092\u5236\u5fa1\u3059\u308c\u3070\u3044\u3044\u3093\u3058\u3083\u306d\uff1f\u3068\u3044\u3046\u30a2\u30a4\u30c7\u30a2\u3002\u5b9f\u969b\u306b\u3084\u3063\u3066\u307f\u305f\u3093\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u554f\u984c\u70b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>UIIWebView\u306e\u6a19\u6e96\u64cd\u4f5c\u3067\u3042\u308b\u30c0\u30d6\u30eb\u30bf\u30c3\u30d7\u3067\u30d6\u30ed\u30c3\u30af\u6700\u9069\u5316\u30ba\u30fc\u30e0(?)\u52d5\u4f5c\u304c\u4f7f\u3048\u306a\u304f\u306a\u308b <\/li>\n<li>\u30ba\u30fc\u30e0\u306e\u54c1\u8cea\u304c\u4f4e\u3044\uff08\u6587\u5b57\u304c\u30dc\u30b1\u308b\uff09 <\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u4f55\u3088\u308a\u3001\u3088\u304f\u3088\u304fAPI\u30ac\u30a4\u30c9\u3092\u8aad\u3093\u3060\u3089\u300cUIWebView\u3068UITableView\u3092UIScrollView\u306e\u4e0a\u306b\u7f6e\u304f\u306e\u306f\u4e88\u671f\u305b\u306c\u52d5\u4f5c\u3092\u5f15\u304d\u8d77\u3053\u3059\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u63a8\u5968\u3057\u306a\u3044\u300d\u3068\u66f8\u3044\u3066\u3042\u3063\u305f\u3002\u7981\u6b62\u3067\u306f\u306a\u3044\u306e\u3067AppStore\u306e\u5be9\u67fb\u3067\u30ea\u30b8\u30a7\u30af\u30c8\u3055\u308c\u308b\u3068\u3044\u307b\u3069\u3067\u306f\u306a\u3044\u304b\u3082\u77e5\u308c\u306a\u3044\u3051\u308c\u3069\u3001\u5c06\u6765\u7684\u306aAPI\u306e\u4ed5\u69d8\u5909\u66f4\u3067\u304a\u304b\u3057\u306a\u3053\u3068\u306b\u306a\u3089\u306a\u3044\u3068\u3082\u9650\u3089\u306a\u3044\u3002<\/p>\n<p>\u3067\u3001\u60a9\u3093\u3060\u672b\u306b\u8fbf\u308a\u7740\u3044\u305f\u7b54\u3048\u306f\u3001stringByEvaluatingJavaScriptFromString\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066Web\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u66f8\u304d\u63db\u3048\u308b\u65b9\u6cd5\u3002<\/p>\n<p>\u307e\u305a\u5358\u7d14\u306a\u4f8b\u3002<\/p>\n<p class=\"code\">[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat: @&quot;window.scrollTo(0, 100);&quot;]];<\/p>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001Web\u30b3\u30f3\u30c6\u30f3\u30c4\u4e0a\u3067\u300cwindow.scrollTo(0,100);\u300d\u3068\u3044\u3046JavaScript\u3092\u5b9f\u884c\u3057\u305f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u753b\u9762\u304c\u4e0b\u306b100\u30d4\u30af\u30bb\u30eb\u5206\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u5fdc\u7528\u3057\u3066\u3001iOS\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u5bfe\u3059\u308b\u30ba\u30fc\u30e0\u5b9a\u7fa9\u3092meta\u30bf\u30b0\u3067\u8ffd\u52a0\u3057\u3066\u3084\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3092\u3057\u3066\u3084\u308b\u30ef\u30b1\u3067\u3059\u3002meta\u30bf\u30b0\u306e\u4ed5\u69d8\u306b\u3064\u3044\u3066\u306f<a href=\"http:\/\/developer.apple.com\/library\/safari\/#documentation\/appleapplications\/reference\/SafariHTMLRef\/Articles\/MetaTags.html\">Apple\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u53c2\u7167\u3059\u308b\u304b\u3001\u300cmeta viewport\u300d\u306a\u3069\u3067\u30b0\u30b0\u3063\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u4eca\u56de\u306e\u95b2\u89a7\u5bfe\u8c61\u30da\u30fc\u30b8\u306f\u3053\u306emeta\u30bf\u30b0\u81ea\u4f53\u304c\u5b58\u5728\u3057\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30bf\u30b0\u81ea\u4f53\u3092\u4f5c\u6210\u3057\u3066head\u30bf\u30b0\u306e\u4e2d\u3001title\u30bf\u30b0\u306e\u524d\u306b\u633f\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p class=\"code\">[webView stringByEvaluatingJavaScriptFromString:@&quot;var bodyNode = document.getElementsByTagName(&#8216;head&#8217;).item(0);&quot;&#160;&#160; <br \/>&quot;var titleNode = document.getElementsByTagName(&#8216;title&#8217;).item(0);&quot;     <br \/>&quot;var newNode = document.createElement(&#8216;meta&#8217;);&quot;     <br \/>&quot;newNode.name = &#8216;viewport&#8217;;&quot;     <br \/>&quot;newNode.content = &#8216;width = 1024, initial-scale = 1.2, minimum-scale = 0.3, maximum-scale = 1.2&#8217;;&quot;     <br \/>&quot;bodyNode.insertBefore(newNode, titleNode);&quot;]; <\/p>\n<p>@\u201d\u201d\u306e\u6587\u5b57\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f;\u3067\u5207\u3089\u306a\u3044\u9650\u308a\u6539\u884c\u5165\u308c\u3066\u5217\u6319\u3067\u304d\u308b\u306e\u3067\u3001\u898b\u3084\u3059\u3055\u306e\u70ba\u306b\u305d\u3046\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\uff11\u884c\u76ee\u3067bodyNode\u3068\u3044\u3046\u5909\u6570\u306bhead\u30bf\u30b0\u306e\u4f4d\u7f6e\u3092\u53d6\u5f97\u3002<\/p>\n<p>\uff12\u884c\u76ee\u3067titleNode\u3068\u3044\u3046\u5909\u6570\u306btitle\u30bf\u30b0\u306e\u4f4d\u7f6e\u3092\u53d6\u5f97\u3002<\/p>\n<p>\uff13\u884c\u76ee\u3067newNode\u3068\u3044\u3046\u5909\u6570\u306bmeta\u30bf\u30b0\u3092\u4f5c\u6210\u3002<\/p>\n<p>\uff14\u884c\u76ee\u3067\u305d\u308c\u306b\u300cname=\u2019Viewport\u2019\u300d\u306b\u76f8\u5f53\u3059\u308b\u8a18\u8ff0\u3092\u8ffd\u52a0\u3002<\/p>\n<p>\uff15\u884c\u76ee\u306b\u66f4\u306b\u300ccontent = &#8216;width = 1024, initial-scale = 1.2, minimum-scale = 0.3, maximum-scale = 1.2&#8217;;&quot; \u300d\u3092\u8ffd\u52a0\u3002\u6570\u5024\u306f\u9069\u5b9c\u72b6\u6cc1\u306b\u3042\u308f\u305b\u3066\u8abf\u6574\u3092\u3002\u3061\u306a\u307f\u306b=\u306e\u524d\u5f8c\u306b\u30b9\u30da\u30fc\u30b9\u304c\u306a\u3044\u3068\u30c0\u30e1\u3068\u3069\u3063\u304b\u3067\u8aad\u3093\u3060\u306e\u3067\u305d\u3046\u3057\u3066\u307e\u3059\u3002<\/p>\n<p>\uff16\u884c\u76ee\u3067\u3001bodyNode(=head\u30bf\u30b0)\u5185\u306etitleNode(=title\u30bf\u30b0)\u306e\u76f4\u524d\u306bnewNode\uff08=meta\u30bf\u30b0)\u3092\u633f\u5165\u3057\u3066\u5b8c\u6210\u3067\u3059\u3002<\/p>\n<p>&#160;<\/p>\n<p>\u6700\u521d\u304b\u3089\u300c&lt;meta name=\u2019viewport\u2019\u2026&gt;\u300d\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u30da\u30fc\u30b8\u306b\u5bfe\u3057\u3066\u306fcontent\u3060\u3051\u3092\u66f8\u304d\u63db\u3048\u308b\u3088\u3046\u306a\u51e6\u7406\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u3067\u3001\u6c4e\u7528\u7684\u306aWeb\u30d6\u30e9\u30a6\u30b6\u3068\u3057\u3066\u4f7f\u3046\u306a\u3089\u5206\u5c90\u51e6\u7406\u3082\u5165\u3063\u305f\u3082\u3046\u5c11\u3057\u8907\u96d1\u306aJavaScript\u304c\u5fc5\u8981\u3067\u3057\u3087\u3046\u304c\u3001\u4eca\u56de\u306f\u5bfe\u8c61\u30b5\u30a4\u30c8\u304c\u56fa\u5b9a\u306e\u30a2\u30d7\u30ea\u306a\u306e\u3067\u3053\u308c\u3060\u3051\u3067\u6e08\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3067\u3059\u3002 \u30a2\u30d7\u30ea\u5185\u306bWeb\u30d6\u30e9\u30a6\u30b6\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3042\u308bUIWebView\u3092\u57cb\u3081\u8fbc\u3093\u3067\u7c21\u6613\u7684\u306bWeb\u30da\u30fc\u30b8\u3092\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u305d\u306e\u8868\u793a\u500d\u7387\u3092\u76f4\u63a5\u5236\u5fa1\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u308a\u307e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[142],"tags":[],"class_list":["post-1515","post","type-post","status-publish","format-standard","hentry","category-cat190"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/posts\/1515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/comments?post=1515"}],"version-history":[{"count":0,"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/posts\/1515\/revisions"}],"wp:attachment":[{"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/media?parent=1515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/categories?post=1515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/do-gugan.com\/~furuta\/wp-json\/wp\/v2\/tags?post=1515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}