반응형
//find rect that encloses all coords
float maxLat = -200;
float maxLong = -200;
float minLat = MAXFLOAT;
float minLong = MAXFLOAT;
for (int i=0 ; i<[locations count] ; i++) {
CLLocationCoordinate2D location = [locations objectAtIndex:i];
if (location.latitude < minLat) {
minLat = location.latitude;
}
if (location.longitude < minLong) {
minLong = location.longitude;
}
if (location.latitude > maxLat) {
maxLat = location.latitude;
}
if (location.longitude > maxLong) {
maxLong = location.longitude;
}
}
//Center point
CLLocationCoordinate2D center = CLLocationCoordinate2DMake((maxLat + minLat) * 0.5, (maxLong + minLong) * 0.5);
오류 부분 있을 수 있습니다~
반응형
'iOS > Objective - C' 카테고리의 다른 글
UITextField - 텍스트가 변경 될 때 불리는 델리게이트 메소드는? (0) | 2017.12.21 |
---|