0
A
回答
0
变焦踢下面的代码是使用了变焦面值为销的距离的最大距离。
-(void) centerMap
{
MKCoordinateRegion region;
CLLocationDegrees maxLat = -90;
CLLocationDegrees maxLon = -180;
CLLocationDegrees minLat = 120;
CLLocationDegrees minLon = 150;
NSArray *temp=self.AS;
// NSArray *temp=[NSArray arrayWithArray:[NSArray arrayWithArray:[reports objectAtIndex:0]]];
for (int i=0; i<[temp count];i++) {
Place* home = [[[Place alloc] init] autorelease];
home.latitude = [[[temp objectAtIndex:i] valueForKey:@"latitude"]floatValue];
home.longitude =[[[temp objectAtIndex:i] valueForKey:@"longitude"]floatValue];
PlaceMark* from = [[[PlaceMark alloc] initWithPlace:home] autorelease];
CLLocation* currentLocation = (CLLocation*)from ;
if(currentLocation.coordinate.latitude > maxLat)
maxLat = currentLocation.coordinate.latitude;
if(currentLocation.coordinate.latitude < minLat)
minLat = currentLocation.coordinate.latitude;
if(currentLocation.coordinate.longitude > maxLon)
maxLon = currentLocation.coordinate.longitude;
if(currentLocation.coordinate.longitude < minLon)
minLon = currentLocation.coordinate.longitude;
region.center.latitude = (maxLat + minLat)/2;
region.center.longitude = (maxLon + minLon)/2;
region.span.latitudeDelta = maxLat - minLat;
region.span.longitudeDelta = maxLon - minLon;
}
[mapView setRegion:region animated:YES];
}
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
if (annotation == mapView.userLocation)
return nil;
MKPinAnnotationView *pin = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier: @"asdf"];
if (pin == nil)
pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: @"asdf"] autorelease];
else
pin.annotation = annotation;
pin.userInteractionEnabled = YES;
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[disclosureButton setFrame:CGRectMake(0, 0, 30, 30)];
pin.rightCalloutAccessoryView = disclosureButton;
pin.pinColor = MKPinAnnotationColorRed;
//pin.animatesDrop = YES;
[pin setEnabled:YES];
[pin setCanShowCallout:YES];
return pin;
}
此代码可能有助于创造新的应用程序,
+0
Thanku所有抱歉不清楚我有一个图像覆盖在相机上,我需要根据距离一些lat的长度来放大 – amar 2012-03-12 09:02:26
+0
没关系,欢迎 – 2012-03-12 09:22:28
相关问题
- 1. JS - 基于距离
- 2. 距离Cell塔的距离
- 3. iPhone:设置基于距离的地图缩放级别
- 4. 颜色基于距离
- 5. 单点的距离
- 6. 如何获得距离眩晕两点之间的距离
- 7. 距离某一点的线段距离上的点
- 8. 找到距离地点最小总距离的点的算法
- 9. 创建距离矩阵?
- 10. 根据距离原点的距离排序2d点
- 11. 如何计算距离另一点一定距离的点的纬度/经度?
- 12. 如何计算距离另一点一定距离的点的纬度?
- 13. 基于距离的SQL平均数据
- 14. 基于Levenshtein距离的方法Vs Soundex
- 15. 基于距离的地图阴影
- 16. 基于距离矩阵的聚类
- 17. 计算距离位置的距离 - iPhone
- 18. 获取距离边缘的距离3
- 19. 每个文档中两点之间的距离和距离小于英里的距离
- 20. Lucene.Net排序距离点的结果
- 21. CLLocationCoordinate2D考虑缩放级别的两点之间的距离
- 22. python如何从scipy浓缩距离矩阵中获得适当的距离值
- 23. MongoDB $ geoNear的距离不同于Google Maps的距离
- 24. 特定距离内的点
- 25. 到点的最短距离
- 26. 蛇的头部距离身体有几点距离(C++游戏)
- 27. 从距离阈值距离更近的云中移除点
- 28. 通过距离参考点的距离查找全部
- 29. Android:MapController.zoomToSpan:给定距离和中心点的距离
- 30. Python:计算点距离N的距离尺寸线
我不知道很清楚它是什么您有一个问题。你想提供一些更详细的信息,说明你到目前为止已经尝试了什么,以及你有什么问题? – 2012-02-17 08:33:14