单击图钉(注释)时显示弹出视图,它显示正常,之后当我放大或缩小地图时,弹出视图不会根据地图缩放移动到。所以我得到了附件图像中的问题。如何根据地图上受人尊敬的图钉移动弹出窗口(当缩放地图时)?
任何建议都非常有帮助。
-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
NSString *strTitle = [NSString stringWithFormat:@"%@",[view.annotation title]];
NSMutableDictionary *dict;
NSMutableArray *temp = annotationArray;
for (int i = 0; i<[temp count]; i++)
{
dict = (NSMutableDictionary*)[temp objectAtIndex:i];
NSString *strAddress = [NSString stringWithFormat:@"%@",[dict valueForKey:@"name"]];
if([strAddress isEqualToString:strTitle]) {
[mapView deselectAnnotation:view.annotation animated:YES];
detailsViewController = [[PopOverViewController alloc] initWithNibName:@"PopOverViewController" bundle:nil];
// [viewsPassage addObject:view];
// NSOrderedSet *orderedSet = [[NSOrderedSet alloc] initWithArray:viewsPassage];
// viewsPassage = [[NSMutableArray alloc] initWithArray:[orderedSet array]];
if ([viewsPassage containsObject:view]) {
NSLog(@"present");
[self.poc dismissPopoverAnimated:YES];
}
self.poc = [[UIPopoverController alloc] initWithContentViewController:detailsViewController];
self.poc.contentViewController.view.alpha = 0;
[viewsPassage addObject:userMapView];
[self.poc setPassthroughViews:viewsPassage];
[detailsViewController.textLabel setText:strAddress];
//size as needed
self.poc.popoverContentSize = CGSizeMake(320, 400);
//show the popover next to the annotation view (pin)
CGRect popOverFrame = view.bounds;
popOverFrame.size.width = 14;
popOverFrame.size.height = 14;
[self.poc presentPopoverFromRect:popOverFrame inView:view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
break;
}
}
}
提前致谢