它的第二天在Titanium SDK上。
我想在地图上显示多个注释。我在SO上提到了答案,但找不到修复!
我尝试了以下代码: -
// To create map
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region:{latitude:33.74511, longitude:-84.38993, latitudeDelta:0.5, longitudeDelta:0.5},
animate:true,
regionFit:true,
userLocation:true,
annotations:[createAnnotations()],
top:110,
height:200
});
// CREATE ANNOTATIONS
function createAnnotations ()
{
var annoatationData = [];
for (var i=0; i < 10; i++)
{
var mountainView = Titanium.Map.createAnnotation(
{
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor: isAndroid ? "orange" : Titanium.Map.ANNOTATION_RED,
animate:true,
myid:i // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
});
annoatationData.push(mountainView);
};
return annoatationData ;
}
但我收到此错误
[ERROR]传递给函数的类型无效。预期:NSDictionary,是: __NSArrayM in - [TiMapView annotationFromArg:](TiMapView.m:96)
有什么建议吗?
...谢谢
答案 0 :(得分:3)
解决了!!!
刚刚替换了这行代码:
annotations:[createAnnotations()],
带
annotations:createAnnotations(),