{"id":165461,"date":"2013-01-11T13:39:03","date_gmt":"2013-01-11T09:39:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=165461"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=165461","title":{"rendered":"<span class=\"post_title\">Google Maps \u043d\u0430 iPhone \u0431\u0435\u0437 GoogleSDK<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\tGoogle \u043a\u0430\u0440\u0442\u044b \u0434\u043b\u044f iPhone \u0432\u044b\u0448\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e, \u0438 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c API \u043a\u043b\u044e\u0447 \u0434\u043b\u044f SDK. \u041c\u043e\u0436\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0437\u0434\u0435\u0441\u044c, \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u044f \u043d\u0430\u043f\u0438\u0448\u0443.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 JavaScript API. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0432\u044b\u0431\u0440\u0430\u043b Direction API.<br \/>  \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f 2 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u00ab\u043e\u0442\u043a\u0443\u0434\u0430\u00bb \u0438 \u00ab\u043a\u0443\u0434\u0430\u00bb \u0438 \u00abWebView\u00bb \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/29c\/81b\/4f0\/29c81b4f0b6b4678827db7d1ced457bf.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 WebView \u044f \u0437\u0430\u0434\u0430\u043b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u043d\u0430\u0437\u0432\u0430\u043b \u0435\u0433\u043e \u00abmap.html\u00bb. \u0412\u043e\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435:  <\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html&gt;     &lt;head&gt;         &lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0, user-scalable=no&quot; \/&gt;         &lt;style type=&quot;text\/css&quot;&gt;             html { height: 100% }             body { height: 100%; margin: 0; padding: 0 }             #map_canvas { height: 100% }             &lt;\/style&gt;         &lt;script type=&quot;text\/javascript&quot; src=&quot;https:\/\/maps.googleapis.com\/maps\/api\/js?v=3.exp&sensor=true&quot;&gt;&lt;\/script&gt;         &lt;script type=&quot;text\/javascript&quot;&gt;                          var directionsDisplay;             var directionsService = new google.maps.DirectionsService();             var map;                          function initialize() {                 directionsDisplay = new google.maps.DirectionsRenderer();                 var chicago = new google.maps.LatLng(41.850033, -87.6500523);                 var mapOptions = {                     zoom:7,                     mapTypeId: google.maps.MapTypeId.ROADMAP,                     center: chicago                 }                 map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;), mapOptions);                 directionsDisplay.setMap(map);                                  calcRoute('chicago, il', 'st louis, mo');             }                          function calcRoute(start, end) {                 var request = {                     origin:start,                     destination:end,                     travelMode: google.maps.TravelMode.DRIVING                 };                 directionsService.route(request, function(result, status) {                     if (status == google.maps.DirectionsStatus.OK) {                         directionsDisplay.setDirections(result);                     }                 });             }         &lt;\/script&gt;     &lt;\/head&gt;     &lt;body onload=&quot;initialize()&quot;&gt;         &lt;div id=&quot;map_canvas&quot; style=&quot;width:100%; height:100%&quot;&gt;&lt;\/div&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0412 \u00abviewDidLoad\u00bb \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00abcreateMap\u00bb, \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442\u044b. \u041a\u043e\u0434 \u00abcreateMap\u00bb:<\/p>\n<pre><code class=\"objectivec\">- (void) createMap:(id)sender{     [map loadHTMLString:[self readFile:[[NSBundle mainBundle] pathForResource:@&quot;map&quot; ofType:@&quot;html&quot;]] baseURL:[NSURL URLWithString:@&quot;google.com&quot;]]; } <\/code><\/pre>\n<p>  \u0418 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u00abto\u00bb \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a:<\/p>\n<pre><code class=\"objectivec\">- (void) findOnMap:(id)sender{     [map stringByEvaluatingJavaScriptFromString:      [[[[@&quot;calcRoute('&quot; stringByAppendingString: from.text ] stringByAppendingString: @&quot;', '&quot;] stringByAppendingString: to.text] stringByAppendingString: @&quot;');&quot; ]     ]; } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 API \u0437\u0430\u043f\u0440\u043e\u0441 \u043a GoogleMaps. \u042d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043f\u043e\u043a\u0430 \u0433\u0443\u0433\u043b \u043d\u0435 \u043d\u0430\u0447\u043d\u0451\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0438 \u043a SDK \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443.<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/69b\/468\/008\/69b4680080060e99748bce543e45d4a6.jpg\"\/> \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/165461\/\"> http:\/\/habrahabr.ru\/post\/165461\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\tGoogle \u043a\u0430\u0440\u0442\u044b \u0434\u043b\u044f iPhone \u0432\u044b\u0448\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e, \u0438 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c API \u043a\u043b\u044e\u0447 \u0434\u043b\u044f SDK. \u041c\u043e\u0436\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0437\u0434\u0435\u0441\u044c, \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u044f \u043d\u0430\u043f\u0438\u0448\u0443.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-165461","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165461"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165461\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}