ios - 加载 map 时如何直接显示多个注释的标题
<p><p>我正在将多个注释加载到我的 mapView 中。加载 map 时,这些注释会显示为图钉。</p>
<p>通过使用下面的代码,我可以直接显示一个注释的标题,但对于剩余的注释,用户需要点击图钉才能看到标题。</p>
<p>我想在 Mapview 加载时显示所有注释的标题而不触摸注释引脚</p>
<pre><code>NSMutableArray * locations = [ init];
_myAnn = [ init];
_locationCoordinate.latitude = 27.175015;
_locationCoordinate.longitude = 78.042155;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"A";
;
_myAnn = [ init];
_locationCoordinate.latitude = 28.171391;
_locationCoordinate.longitude = 79.037090;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"B";
;
_myAnn = [ init];
_locationCoordinate.latitude = 29.169005;
_locationCoordinate.longitude = 80.043206;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"C ";
;
;
// i am using below method to display title for one annotation
// ;
for (MKPointAnnotation *annotation in locations) {
;
}
MKCoordinateSpan span;
Span. latitudeDelta = 10;
Span. longitudeDelta = 10;
MKCoordinateRegion region;
region.span = span;
region.center = _locationCoordinate;
;
</code></pre>
<p>提前致谢..</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><strong>更新</strong>这似乎确实是不可能的——至少对于 mapView 注释 API 来说是不可能的。尽管存在 select 和 deselect 方法,并且 selected annotations 属性是一个数组,但似乎一次只能选择一个 annotation。</p>
<p>您似乎需要按照此答案中的建议创建自定义注释 View- <a href="https://stackoverflow.com/questions/2417952/multiple-annotation-callouts-displaying-in-mkmapview" rel="noreferrer noopener nofollow">Multiple annotation callouts displaying in MKMapView</a> </p></p>
<p style="font-size: 20px;">关于ios - 加载 map 时如何直接显示多个注释的标题,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/24253631/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/24253631/
</a>
</p>
页:
[1]