我正在将多个注释加载到我的地图视图中。加载地图时,这些注释显示为图钉。
通过使用下面的代码,我可以直接显示一个注释的标题,但对于剩余的注释,用户需要点击 pin 才能看到标题。
我想在加载 Mapview 时显示所有注释的标题而不触摸注释引脚
NSMutableArray * locations = [[NSMutableArray alloc] init];
_myAnn = [[MKPointAnnotation alloc] init];
_locationCoordinate.latitude = 27.175015;
_locationCoordinate.longitude = 78.042155;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"A";
[locations addObject:_myAnn];
_myAnn = [[MKPointAnnotation alloc] init];
_locationCoordinate.latitude = 28.171391;
_locationCoordinate.longitude = 79.037090;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"B";
[locations addObject:_myAnn];
_myAnn = [[MKPointAnnotation alloc] init];
_locationCoordinate.latitude = 29.169005;
_locationCoordinate.longitude = 80.043206;
_myAnn.coordinate = _locationCoordinate;
_myAnn.title = @"C ";
[locations addObject:_myAnn];
[self.map_View addAnnotations:locations];
// i am using below method to display title for one annotation
// [self.map_View selectAnnotation:_myAnn animated:YES];
for (MKPointAnnotation *annotation in locations) {
[self.map_View selectAnnotation:annotation animated:NO];
}
MKCoordinateSpan span;
Span. latitudeDelta = 10;
Span. longitudeDelta = 10;
MKCoordinateRegion region;
region.span = span;
region.center = _locationCoordinate;
[self.map_View setRegion:region animated:YES];
提前致谢..