I want to find where user tapped on MapKit. I cannot find a action to make a connection so i am wondering there is an alternate method for the same. please let me know.
As #Disco S2 says, add the instance of MKMapView as a subview to your view. To know where your user tapped on the map, use this method:
- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view
Put the mapkit inside a view and listen for touches in that view. There is then a method to convert the touch in the mapView to a touch in the view and vice versa. I can't remember the method for converting but it will be in the map kit documentation
Related
I have a map view in that I am showing annotations. On clicking any annotation the callout (bubble with info) will appear above the annotation.
What I want is to navigate to another class by clicking the callout without using CallOutForAccessory delegate method. I have added touch gesture in didselect but it still didn't work. I have looked through the Internet but didn't find any solution for the same. Most of the solutions compromise of CallOutForAccessory. Please share your ideas if anyone has done this before.
I using GoogleMaps.framework in my iOS app. I need detect double tap on marker to do some action.
I try to find some public method to do it, but I am not lucky. Have any way to do it?
By referring to the delegate functions provided by the google map you can detect the if a marker has been clicked on :)
Assuming the marker is a view, can you not add a UITapGestureRecognizer to it and then set the number of taps required to trigger the recognizer to two?
i'm wondering what is the best way to check - is callout view pressed using mapBox iOS SDK?
The only method that i find is this one
- (void)tapOnCalloutAccessoryControl:(UIControl *)control forAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map
but this method checking is accessory pressed in callout view.
Any ideas how to achieve this? Thanks
There is a delegate method called tapOnLabelForAnnotation:onMap in RMMapViewDelegate, you can use this method to get informed about the user tapping the annotation label.
Delegate methods for detecting a press of the callout, instead of just its accessories, do not exist currently.
I am using map on my IOS application. I can see the annotation on my map, and when I tap on that there is the description, which I have set. My question is whether I can have this description visible when map first loads and not make the user tap on the annotation to view it?
is that possible?
Thanks.
use an overlay instead of an annotation
I'm trying to overlay a UIView over a google GMSMapView. The goal is to intercept swipes in order to know when the map is being moved manually. (I know I could check -mapView:willMove: but that gets called regardless of whether the map is moving programmatically or as result of manual touch). I'm programmatically re-centering the map as the position updates--because Google doesn't do it for you like Apple does. Like every map program out there, I want to stop centering on the current position as soon as the user manually moves the map. The only way I can think to capture that occurrence (short of switching to mapkit or waiting for Google to add to the API) is to capture a swipe as it's going past a view laid over the map.
To clarify, my question is how do I lay a view over a google map, make it respond to a swipe and still allow that event to pass through to the GMSMapView?
Both my map and interceptView are sibling children of the main view. interceptView has a gestureRecognizer, is set to opaque, not hidden and userInteractionEnabled = YES. As such the interceptView picks up touch events just fine. But the map underneath doesn't move. If I set interceptView.userInteractionEnabled = NO, the map works fine.
"Passing touches" by overriding touchesBegan and calling GMSMapView's touchesBegan doesn't do anything. And overriding hitTest doesn't seem to be an option because I can't subclass GMSMapView. Has anyone done this? I know there's a lot on here about passing particular events through. I want to process a particular event on two views, one of which is Google's map layer which I can't modify the code of.
mapView:willMove: receives a bool "gesture" which is true if the move was triggered by a user gesture and false if it wasn't. So you can stop re-centering the map only if "gesture" is true. That way you can be sure that the map is being moved manually.
Here is a delegate method check it
- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;
You can intercepte the tap using the GMSMapViewDelegete and implementing this method:
-(void)panoramaView:(GMSPanoramaView *)panoramaView didTap:(CGPoint)point;
Example:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
CLLocationCoordinate2D panoramaNear = {latitudine,longitudine};
GMSPanoramaView *panoView = [GMSPanoramaView panoramaWithFrame:CGRectZero
nearCoordinate:panoramaNear];
[panoView setDelegate:self];
self.view = panoView;
}
-(void)panoramaView:(GMSPanoramaView *)panoramaView didTap:(CGPoint)point{
NSLog(#"Tap");
}