菜鸟教程小白 发表于 2022-12-12 20:51:20

ios - 某些缩放级别后的自动注释标注


                                            <p><p>我想在特定缩放级别后自动显示注释标注。但是,我不想拥有所有的注释标注,而只是那些正在屏幕上显示的标注。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>要显示屏幕上可见的注释标注,只需下面的代码就可以了,因为它依赖于 <code>MKMapView</code> 的 <code>selectAnnotation</code> 方法,当然,检测到所需的缩放级别后:</p>

<pre><code>for (MKAnnotation *annotation in mapView.annotations) {
   if ( MKMapRectContainsPoint(mapView.visibleMapRect, MKMapPointForCoordinate(annotation.coordinate)) ) {
       ;
   }
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 某些缩放级别后的自动注释标注,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22663970/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22663970/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 某些缩放级别后的自动注释标注