有没有办法在注释视图层中设置 z 顺序?
我想让一些annotationView图像出现在其他图像之上,以便更容易看到。有没有办法设置顺序?
我想我会尝试类似的方法
[theMap addAnnotations:arrayOfLessImportantItems];
[theMap addAnnotations:arrayOfMoreImportantItems];
,但在尝试此操作后,很明显委托方法 MKMapViewDelegate mapView:viewForAnnotation
在放下它们时不会观察到任何特定的顺序。 (由于注释视图来自池,当地图在屏幕上移动时,委托必须添加和删除annotationView图像。)
但我确实有少量项目希望更容易看到,它们是被埋在不太重要的地图图钉后面。有办法克服这个问题吗?
I want to have some annotationView images appear on top of the others so they are easier to see. Is there a way to set the order?
I thought I would try something like
[theMap addAnnotations:arrayOfLessImportantItems];
[theMap addAnnotations:arrayOfMoreImportantItems];
But it is obvious after trying this that the delegate method MKMapViewDelegate mapView:viewForAnnotation
doesn't observe any particular order when it puts them down. (Since the annotation views come from a pool, the delegate must be adding and removing annotationView images as the map is shifted around on the screen.)
But I do have a small number items that I want to be easier to see, and they are getting buried behind the less important map pins. Is there a way to overcome this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还可以使用 CALayer 中的 zPosition 属性(您必须包含 QuatzCore.h)来更改视图的 z-index。
就像使用 html/css 一样工作:)
You could also use the zPosition property from CALayer (you will have to include QuatzCore.h) to change the z-index of the view.
Works just the way it would with html/css :)