ios 7中mapview的显示注释中的Region和Span无效



Hi我想显示当前用户的多个注释。我想在一段时间内更新它,但我正在尝试,但收到了有效的辞职和跨度问题。任何帮助都将不胜感激。

id<AppDelegate> theDelegate = (id<AppDelegate>) [UIApplication sharedApplication].delegate;
AppMediator *mediator  = (AppMediator*) theDelegate.mediator;
watchEntityLocationList=[mediator watchNowList];
[watchEntityLocationList retain];
[mapView setDelegate:self];
for(WatchEntityLocation *watchEntityLocation in watchEntityLocationList)
{locationArray=watchEntityLocation.locationList;
    NSLog(@"location count:%i",[locationArray count]);
    Location *location=[locationArray objectAtIndex:0];
    NSLog(@"watcher latlong:%g,%g",location.latitude,location.longitude);
    CLLocationCoordinate2D coordinate= CLLocationCoordinate2DMake(location.latitude,location.longitude);
    if (CLLocationCoordinate2DIsValid(coordinate)) {
          NSLog(@"valid Cordinate!");
    } else {
         NSLog(@"Invalid Cordinate!");}
    NSLog(@"latitude is::%g" , coordinate.latitude);
    NSLog(@"latitude is: :%g" , coordinate.longitude);
    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(coordinate, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE);
    MKCoordinateRegion adjustedRegion = [mapView regionThatFits:viewRegion];
    if ((adjustedRegion.center.latitude >= -90) && (adjustedRegion.center.latitude <= 90) && (adjustedRegion.center.longitude >= -180) && (adjustedRegion.center.longitude <= 180)){NSLog(@"valid region!");
        [mapView setRegion:[mapView regionThatFits:adjustedRegion] animated:TRUE];
    }else{
         NSLog(@"Invalid region!");
    }[self addAnnotation:coordinate tlocation:watchEntityLocation.watchEntity.name];
}

它可能是经纬度数据类型或赋值问题

相关内容

  • 没有找到相关文章