钛 - 进行多个注释 [英] Titanium - make multiple annotation
本文介绍了钛 - 进行多个注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在钛工作室初学者。我能够打开一个图形页面,可以使一个单一的注释。我怎样才能让多个注释对给定的纬度和经度一个图形页面?先谢谢了。
I am a beginner in Titanium Studio. I can able to open a mapview and can make a single annotation. How can I make multiple annotation on a mapview for the given latitudes and longitudes? Thanks in advance.
推荐答案
您可以使用一个循环多个注释。
You can use a loop for multiple annotation.
假设你有有元素的数据数组{纬度,经度,标题}
suppose you have a data array having elements { latitude, longitude, title }
var annotations = [];
for ( var i = 0 ; i<data.length; i++ ) {
// this section will create annotations and add them on the mapview
var pin = Titanium.Map.createAnnotation({
latitude:this.data[i].latitude,
longitude:this.data[i].longitude,
title:this.data[i].title,
animate:true
});
annotations[i] = pin;
// suppose mapView is your map object
mapView.addAnnotation(annotations[i]);
}
这篇关于钛 - 进行多个注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文