我是钛金工作室的初学者。我可以打开一个mapview,并且可以创建一个注释。如何在给定的纬度和经度的地图视图上进行多个注解?提前谢谢。
发布于 2011-12-12 22:13:41
您可以对多个注释使用循环。
假设您有一个包含元素{纬度、经度、标题}的数据数组
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]);
}https://stackoverflow.com/questions/8473612
复制相似问题