2011-12-12 3 views
1

저는 Titanium Studio의 초보자입니다. 나는 mapview를 열 수 있고 하나의 주석을 만들 수있다. 주어진 위도와 경도에 대해지도 뷰에서 여러 주석을 만들려면 어떻게해야합니까? 미리 감사드립니다.티타늄 - 다중 주석 만들기

답변

1

루프를 여러 주석에 사용할 수 있습니다.

는 내가 기능에 전달 잘못된 유형을 얻고있다 데이터 배열을 갖는 요소 {위도, 경도, 제목}

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]); 
} 
+0

이 있다고 가정합니다. 예상 : NSDictionary, : __NSArrayM in - [TiMapView annotationFromArg :] (TiMapView.m : 96) 오류 – Maulik

+0

코드가 무엇입니까? –

+0

그것의 지금 해결 된 : D 코드는 여기에있다 http://stackoverflow.com/questions/9128566/how-to-show-multiple-annotations-on-map – Maulik

관련 문제