Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google map view how can i get original point or frame for annotation while map zoom?

i set custom annotation pin in map on the click of annotation i get call for this method

(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view NS_AVAILABLE(NA, 4_0)

in that method i want to open popover so i want frame form (MKAnnotationView *)view i get right frame while map in normal mode.

but when i zoom map and click on annotation at that time i get wrong frame at that time the x and y value is big, so any solution for that any offset or zoom factor i get so i divide according to that so i get actual frame of annotation.

like image 812
Gaurav Thummar Avatar asked Dec 16 '11 14:12

Gaurav Thummar


People also ask

Can you use Google Maps and zoom at the same time?

Google Maps - cannot zoom and move at the same time with animateCamera, but can with moveCamera. Bookmark this question.

How do I fix Google Maps zoom?

To fix Google maps zooming problems, for Google maps default zoom you want to know how to change the zoom level on Google Maps. You can change the zoom level by going to the Edit map page and then selecting 'default zoom level' in the map information section and then clicking save map.


1 Answers

Try this:

CGPoint annotationPoint = [mapView convertCoordinate:view.annotation.coordinate 
                                   toPointToView:mapView];
float boxDY = annotationPoint.y - 35;
float boxDX = annotationPoint.x - 1;
CGRect box = CGRectMake(boxDX, boxDY, 1, 1);
[popoverControllerDetail presentPopoverFromRect:box 
                                         inView:mapView 
                       permittedArrowDirections:(UIPopoverArrowDirectionDown|
                                                 UIPopoverArrowDirectionLeft|
                                                 UIPopoverArrowDirectionRight) 
                                       animated:YES];
like image 121
Krishna K Avatar answered Oct 23 '22 04:10

Krishna K