您好我想显示当前用户的多个注释。我想在一段时间间隔更新它但我正在尝试但是有效的辞职和跨度问题。非常感谢。
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];
}
答案 0 :(得分:0)
它可能是纬度和经度数据类型或分配值问题