我正在做地图应用。我正在地图上显示注释引脚。在引脚上有一个附件按钮,点击引脚附件按钮,它导航到引脚详细页面。在详细页面有一个删除按钮删除地点。删除当我弹出地图视图时,引脚显示在地图上。但我的对象数组减少了1.但是引脚显示为先前如何解决它。我的要求是当用户弹出地图视图时引脚不会删除在地图上显示。请帮助我.....
答案 0 :(得分:0)
首先尝试此方法,只需在删除注释时调用此方法即可。
-(void) reloadMap
{
[yourMapView setRegion:yourMapView.region animated:TRUE];
}
方法强>
否则只删除所有注释并再次添加数组对象..删除这样的注释
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.04;
span.longitudeDelta=0.04;
region.span=span;
region.center = currentLocation;
[MymapView removeAnnotations:[MymapView annotations]];
MyAnnotation *ann = [[MyAnnotation alloc] init]; ///This is My Annotation class which i create for display detail of location
ann.title =MymapView.userLocation.title;
ann.subtitle = MymapView.userLocation.subtitle;
ann.coordinate = currentLocation;
ann.annLocation=[NSString stringWithFormat:@"%f%f",currentLocation.longitude,currentLocation.latitude];
[MymapView addAnnotation:ann];
[MymapView setRegion:region animated:TRUE];
[MymapView regionThatFits:region];