人
我今天下午遇到了这个问题。 我不希望有不同的跨度......
我的代码是
- (IBAction)arrowClicked:(id)sender
{
UIButton *button = (UIButton *)sender;
for (Annotation *a in self.mapView.annotations) {
if (a.tag==button.tag-800) {
MKCoordinateRegion region = self.mapView.region;
region.center = a.coordinate;
region.span = span;
NSLog(@"%f,%f",region.span.longitudeDelta, region.span.longitudeDelta);
NSLog(@"%i",a.tag);
NSLog(@"arrowClicked1 %f,%f",self.mapView.region.span.longitudeDelta, self.mapView.region.span.longitudeDelta);
NSLog(@"arrowClicked1 %f,%f",region.span.longitudeDelta, region.span.longitudeDelta);
[self.mapView setRegion:region animated:YES];
NSLog(@"arrowClicked2 %f,%f",self.mapView.region.span.longitudeDelta, self.mapView.region.span.longitudeDelta);
[self.mapView selectAnnotation:a animated:NO];
break;
}
}
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
NSLog(@"will changed");
for (UIImageView *arrow in self.mapView.subviews) {
if (arrow.tag>=800) {
[arrow removeFromSuperview];
}
}
NSLog(@"regionWillChangeAnimated %f,%f",self.mapView.region.span.longitudeDelta, self.mapView.region.span.longitudeDelta);
}
,日志是
2012-04-11 20:23:46.471 SFMap[4113:11603] 103
2012-04-11 20:23:46.471 SFMap[4113:11603] arrowClicked1 0.109863,0.109863
2012-04-11 20:23:46.472 SFMap[4113:11603] arrowClicked1 0.109863,0.109863
2012-04-11 20:23:46.472 SFMap[4113:11603] will changed
2012-04-11 20:23:46.472 SFMap[4113:11603] regionWillChangeAnimated 0.109863,0.109863
2012-04-11 20:23:46.472 SFMap[4113:11603] arrowClicked2 0.219727,0.219727
我发现这个问题发生在annotationList的最后一个注释上。
有人可以解雇我吗? 感谢~~
答案 0 :(得分:1)