mkannotation

MKAnnotationView and tap detection

旧时模样 提交于 2019-11-28 09:20:46
I have a MKMapView . I added a UITapGestureRecognizer with a single tap. I now want to add a MKAnnotationView to the map. I can tap the annotation and mapView:mapView didSelectAnnotationView:view fires (which is where I'll add additional logic to display a UIView). The issue is now when I tap the annotation, the MKMapView tap gesture also fires. Can I set it so if I tap the annotation, it only responds? There might be a better and cleaner solution but one way to do the trick is exploiting hitTest:withEvent: in the tap gesture recognized selector, e.g. suppose you have added a tap gesture

MKAnnotationView always shows infoButton instead of detailDisclosure btn

给你一囗甜甜゛ 提交于 2019-11-28 08:23:22
问题 has somebody an idea why i can't force the mapView callout to use a detailDisclosureBtn instead of infoButton? - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"HPIPAnnotation"; if ([annotation isKindOfClass:[CoreCityAnnotation class]]) { MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (annotationView == nil) { annotationView =

Animate removal of annotations

ⅰ亾dé卋堺 提交于 2019-11-28 07:39:23
I have a map and a set of annotations, each with a 'parent' property. Currently when I add annotations I implement the didAddAnnotationViews method to animate those annotations so they appear to come from their parent's coordinate. Is there a way of doing this during the removal of annotations? When I remove an annotation from the map I want it to animate in to its parent coordinate, and as far as I know there is no equivalent for didAddAnnotationViews for when an annotation is removed. Animate annotation before you remove it from the map and perform removal after animation is completed. The

Detect Tap on CalloutBubble in MKAnnotationView

三世轮回 提交于 2019-11-28 07:21:42
Im working with MKMapView and MKAnnotationView. I have an annotation in the map. When the users tap on it, the callOut Bubble is displayed. When the annotation is tapped again ( and the callOut Bubble is visible ) i need to change to another view. How can i detect the second tap, or the tap in the bubble? Could you add a gesture recognizer when you're initializing the MKAnnotationView ? Here's the code for inside dequeueReusableAnnotationViewWithIdentifier: UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(calloutTapped:)];

Customizing the MKAnnotation Callout bubble

安稳与你 提交于 2019-11-28 06:59:36
I have a requirement in my application map page. I have to customize the Callout bubbles. I need to add an image, two labels and a button with specific height and width of each. I have gone through web and could not find a proper link that explains how to customize the callout bubbles. If any one of you come across or know about it please share with me. any simple examples or links would be really great. Thanks in advance suresh MathieuF An example to help you : - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { MKAnnotationView *annotationView

Need to add a Fixed Overlay like on mapview in IOS

拜拜、爱过 提交于 2019-11-28 06:49:36
问题 I need to create a map view interface, which is something similar to the OLA Cabs Application in iOS. What I exactly wanna do is to fix an overlay on mapView and allow the user to scroll the map view across it. So that the overlay can be fixed at any location the User wants it to, I searched a lot about overlays, in iOS and MapKit, but couldn't make it possible. If some one can give me tips for achieving this I would be really grateful. Here is a snapshot of the screen Here the annotation

How to access to an annotation attribute inside method calloutAccessoryControlTapped

你说的曾经没有我的故事 提交于 2019-11-28 06:39:41
问题 I am trying to open a detail viewController when a user taps on the callout from a map annotation. I have created a custom annotation subclass called myAnnotation, and there I have included a property called idEmpresa. At a custom method I am declaring the annotation as follows: double latitud = [[[categorias objectAtIndex:i] objectForKey:@"latitud"] doubleValue]; double longitud = [[[categorias objectAtIndex:i] objectForKey:@"longitud"]doubleValue]; CLLocationCoordinate2D lugar; lugar

How can I group MKAnnotations automatically regarding zoom level?

青春壹個敷衍的年華 提交于 2019-11-28 05:06:10
if the user zooms out on a MKMapView, i want MKAnnotations which are near to each other automatically grouped into one "group" annotation. if the user zooms back in, the "group" annotation should be split again to the unique/original annotations. apple does this already in the iOS 4 Photos.app is there a common, "predefined" way to do this? ninjaproger Its normal working with more than 1500 annotations on the map: -(void)mapView:(MKMapView *)mapView_ regionDidChangeAnimated:(BOOL)animated { NSMutableSet * coordSet = [[NSMutableSet alloc] init]; for(id<MKAnnotation> an in mapView_.annotations)

How to open call out MKAnnotationView programmatically? (iPhone, MapKit)

不羁岁月 提交于 2019-11-28 04:42:52
I want to open up the callout for an MKPinAnnotationView programmatically. Eg I drop 10 pins on the map, and want to open up the one closest to me. How would I go about doing this? Apple has specified the 'selected' parameter for MKAnnotationView's , but discourages setting it directly (this doesn't work, tried it). For the rest MKAnnotationView only has a setHighlighted ( same story ), and can ShowCallout method.. Any hints if this is possible at all? Chip Coons In your mapViewController create an action method: - (void)openAnnotation:(id)annotation { //mv is the mapView [mv selectAnnotation

How to remove all annotations from MKMapView without removing the blue dot?

可紊 提交于 2019-11-28 04:23:15
I would like to remove all annotations from my mapview without the blue dot of my position. When I call: [mapView removeAnnotations:mapView.annotations]; all annotations are removed. In which way can I check (like a for loop on all the annotations) if the annotation is not the blue dot annotation? EDIT (I've solved with this): for (int i =0; i < [mapView.annotations count]; i++) { if ([[mapView.annotations objectAtIndex:i] isKindOfClass:[MyAnnotationClass class]]) { [mapView removeAnnotation:[mapView.annotations objectAtIndex:i]]; } } Looking at the MKMapView documentation , it seems like you