ios - 有没有办法防止标注在 MapboxGL for iOS 中滚动时消失?
<p><p><strong>我需要做什么:</strong></p>
<p>在标注 View 存在时滚动 map 不应关闭标注 View 。标注 View 也应该随着 map 滚动。</p>
<p><strong>我有什么</strong></p>
<ul>
<li>我的标注 View 是 MGLAnnotationView 的子类</li>
<li>在<code>中呈现- (nullable MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id <MGLAnnotation>)annotation;</code></li>
</ul>
<p><strong>我尝试过但没用的方法</strong></p>
<ol>
<li><p>我可以构建框架,但是修改要么不接受,要么我遗漏了一些东西:我已经注释掉了 <code>- (void)deselectAnnotation:(id <MGLAnnotation>)annotation 的内容动画:(BOOL)动画</code>在 MapViewController.mm 中。</p></li>
<li><p>我已尝试覆盖我的标注 View 的 <code>setAlpha</code>、<code>setHidden</code> 和 <code>removeFromSuperView</code> 方法。他们都没有被调用。</p></li>
</ol></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>有一个<code>bug</code> <a href="https://github.com/mapbox/mapbox-gl-native/pull/6676" rel="noreferrer noopener nofollow">fix</a> <strong>2016 年 10 月</strong>:。我最近还尝试了一个示例项目,其中我对 <code>MGLAnnotationView</code> 进行了子类化。只要您对这两个属性进行了子类化,它现在似乎就可以正常工作了:</p>
<pre><code>var dismissesAutomatically = false
var isAnchoredToAnnotation = true
</code></pre></p>
<p style="font-size: 20px;">关于ios - 有没有办法防止标注在 MapboxGL for iOS 中滚动时消失?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/39398733/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/39398733/
</a>
</p>
页:
[1]