ios - 标记未显示在 GMSPanoramaView 上
<p><p>我有一个简单的测试应用程序,我在其中执行以下代码</p>
<pre><code> let marker = GMSMarker(position:CLLocationCoordinate2DMake(33.987884, -118.474434))
marker.icon = GMSMarker.markerImageWithColor(UIColor.redColor())
marker.panoramaView = panoramaView;
marker.snippet = "I am Here!"
panoramaView.moveNearCoordinate(marker.position)
</code></pre>
<p>如果我将坐标移动到海滩外的其他街道,我可以很好地看到标记。但是从上面的代码中我什么也没看到。有谁知道为什么我可以让一个区域在 GMSPanoramaView 中正常显示,但是在那里放置一个标记不起作用?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我认为有些实现没有完成。不确定这些实现是什么,但我找到了一些关于您的问题的教程。或者根据文档“注意,如果marker的位置离panoramaView的当前全景位置太远,太小就不会显示了”。 </p>
<p>查看<a href="https://developers.google.com/maps/documentation/ios-sdk/streetview" rel="noreferrer noopener nofollow">Street View locations and point-of-view (POV)</a> :</p>
<pre><code>GMSPanoramaView *panoView_;
panoView_.camera = [GMSPanoramaCamera cameraWithHeading:180
pitch:-10
zoom:1];
</code></pre>
<p>街景中的标记</p>
<pre><code>// Create a marker at the Eiffel Tower
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(48.858,2.294);
GMSMarker *marker = ;
// Add the marker to a GMSPanoramaView object named panoView_
marker.panoramaView = panoView_;
// Add the marker to a GMSMapView object named mapView_
marker.map = mapView_;
</code></pre>
<p>这是第一个选项,另一个选项是 <code>WebView</code> 内的 <code>Google Maps JavaScript API</code>。 <a href="https://developers.google.com/maps/documentation/javascript/examples/streetview-overlays" rel="noreferrer noopener nofollow">https://developers.google.com/maps/documentation/javascript/examples/streetview-overlays</a> </p>
<pre><code>var panorama;
function initMap() {
var astorPlace = {lat: 40.729884, lng: -73.990988};
// Set up the map
var map = new google.maps.Map(document.getElementById('map'), {
center: astorPlace,
zoom: 18,
streetViewControl: false
});
// Set up the markers on the map
var cafeMarker = new google.maps.Marker({
position: {lat: 40.730031, lng: -73.991428},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=cafe|FFFF00',
title: 'Cafe'
});
var bankMarker = new google.maps.Marker({
position: {lat: 40.729681, lng: -73.991138},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=dollar|FFFF00',
title: 'Bank'
});
var busMarker = new google.maps.Marker({
position: {lat: 40.729559, lng: -73.990741},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=bus|FFFF00',
title: 'Bus Stop'
});
// We get the map's default panorama and set up some defaults.
// Note that we don't yet set it visible.
panorama = map.getStreetView();
panorama.setPosition(astorPlace);
panorama.setPov(/** @type {google.maps.StreetViewPov} */({
heading: 265,
pitch: 0
}));
}
function toggleStreetView() {
var toggle = panorama.getVisible();
if (toggle == false) {
panorama.setVisible(true);
} else {
panorama.setVisible(false);
}
}
</code></pre>
<p>这里是教程和代码的<code>repo</code>链接</p>
<ul>
<li> <a href="http://googlegeodevelopers.blogspot.com/2013/09/sun-surveyor-shines-with-street-view.html" rel="noreferrer noopener nofollow">http://googlegeodevelopers.blogspot.com/2013/09/sun-surveyor-shines-with-street-view.html</a> </li>
<li> <a href="https://github.com/ratana/streetview-panorama-demo" rel="noreferrer noopener nofollow">https://github.com/ratana/streetview-panorama-demo</a>
我希望这会有所帮助。</li>
</ul></p>
<p style="font-size: 20px;">关于ios - 标记未显示在 GMSPanoramaView 上,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37304881/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37304881/
</a>
</p>
页:
[1]