我有一个应用程序,我在地图上放置了多个注释。但是现在我想在删除这些注释时跨越我的地图。这是我在地图上添加注释的代码。
- (void)viewDidLoad {
[super viewDidLoad];
mapView.mapType = MKMapTypeStandard;
mapView.showsUserLocation = YES;
NSMutableArray *annotations = [[NSMutableArray alloc]init];
[annotations addObjectsFromArray:appDelegate.maparray];
NSLog(@"%@",annotations);
if ([annotations count])
{
for (int i =0; i < [annotations count]; i++)
{
dict = [annotations objectAtIndex:i];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = [[dict objectForKey:@"Latitude"] floatValue];
region.center.longitude = [[dict objectForKey:@"Longitude"] floatValue];
region.span.longitudeDelta = 0.6f;
region.span.latitudeDelta = 0.6f;
Title = [dict objectForKey:@"Title"];
description = [dict objectForKey:@"DescriptionMobile"];
NSLog(@"%@",description);
NSURL *url = [NSURL URLWithString:[dict objectForKey:@"Image"]];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
image = [[UIImage alloc] initWithData:data];
MyAnnotation *ann = [[MyAnnotation alloc] init];
ann.title = Title;
ann.subtitle = description;
[mapView addAnnotation:ann];
}
}
}
如何将我的地图跨越到我的注释点,以便我的所有注释都可见并且我的地图也可以缩放。谢谢