2013-06-26 5 views
0

MKPolylines '+ polylineWithCoordinates:count: 메서드를 호출하려고합니다.CLLocationCoordinate2d 개체를 만드는 방법

이 경우 CLLocationCoordinate2D * 개체를 어떻게 만듭니 까? 나는 CLLocationCoordinate2D without knowing how many will be in the array?

// unpacking an array of NSValues into memory 
CLLocationCoordinate2D *points = malloc([mutablePoints count] * sizeof(CLLocationCoordinate2D)); 
for(int i = 0; i < [mutablePoints count]; i++) { 
[[mutablePoints objectAtIndex:i] getValue:(points + i)]; 
} 

MKPolyline *myPolyline = [MKPolyline polylineWithCoordinates:points count:[mutablePoints count]]; 
free(points); 
위의 경우에 배열 mutablePoints에있는 항목이 어떤 종류의

이 특정 답변을 겪었?

답변

0

배열에 어떤 종류의 항목이 있는지 간단히 대답하면 대답은 매우 간단합니다 : NSValue 항목. NSValues을 사용하는 방법에 대한 자세한 내용은 guide을 참조하십시오.

0
CLLocationCoordinate2D coordinate; 
    for (int i = 0; i < arr.count; i++) 
    { 
     float t1 = [[arr objectAtIndex:1] floatValue]; 
     float t2 = [[arr objectAtIndex:0] floatValue]; 

     coordinate.latitude = t1; 
     coordinate.longitude = t2; 

    } 
+0

OP의 질문과 관련이 없습니다. – micantox

관련 문제