mkannotation

How can I group MKAnnotations automatically regarding zoom level?

孤街醉人 提交于 2019-11-27 05:29:54
问题 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? 回答1: Its normal working with more than 1500 annotations on the map: -(void)mapView:(MKMapView *)mapView_ regionDidChangeAnimated:(BOOL)animated {

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

人走茶凉 提交于 2019-11-27 05:25:11
问题 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? 回答1: In your mapViewController create an

How to display 2 lines of text for subtitle of MKAnnotation and change the image for the button on the right?

旧时模样 提交于 2019-11-27 04:32:17
I am looking at Apple's MapCallouts example for map annotations and callouts (==bubbles that appear when you click on a pin). Every annotation there has coordinates, title and subtitle. I would like to display subtitle in 2 lines, i tried with: - (NSString *)subtitle { return @"Founded: June 29, 1776\nSecond line text"; } but the text "Second line text" stays in one line and makes bubble wider.I get this: I would also like to change image of the button to one of my own's, the code that sets the button is currently like this: UIButton* rightButton = [UIButton buttonWithType

Swift - Add MKAnnotationView To MKMapView

独自空忆成欢 提交于 2019-11-27 03:58:37
I'm trying to add MKAnnotationView to MKMapView but I can't do it… Can anyone help me? Here is my code: override func viewDidLoad() { super.viewDidLoad() locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.startUpdatingLocation() var latitude:CLLocationDegrees = locationManager.location.coordinate.latitude var longitude:CLLocationDegrees = locationManager.location.coordinate.longitude var homeLati: CLLocationDegrees = 40.01540192 var homeLong: CLLocationDegrees = 20.87901079 var latDelta:CLLocationDegrees = 0.01 var longDelta:CLLocationDegrees = 0.01 var theSpan

MKAnnotationView and tap detection

佐手、 提交于 2019-11-27 02:49:31
问题 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? 回答1: There might be a better and cleaner solution but one way to do the trick is

MKMapView annotations changing/losing order?

☆樱花仙子☆ 提交于 2019-11-27 02:06:36
I have a map view with annotations, and these annotations display a callout. When the callout's disclosure detail button is clicked, it segues into a new view. My MKAnnotations are a custom class that implements <MKAnnotation> . Let's call that class MyClass. They are stored in an NSMutableArray. During viewdidload of this view, I add each object of MyClass in this array to the map view's annotations. Using the debugger, I can see that once all of this adding is done, the [self.MapView annotations] order is the same as the NSMutableArray. Now I set another breakpoint within mapView

Detect Tap on CalloutBubble in MKAnnotationView

ぃ、小莉子 提交于 2019-11-27 01:47:46
问题 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? 回答1: Could you add a gesture recognizer when you're initializing the MKAnnotationView ? Here's the code for inside dequeueReusableAnnotationViewWithIdentifier: UITapGestureRecognizer

Customizing the MKAnnotation Callout bubble

心不动则不痛 提交于 2019-11-27 01:39:39
问题 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 回答1: An example to help you : - (MKAnnotationView *)mapView:

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

会有一股神秘感。 提交于 2019-11-27 00:22:36
问题 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:

How to keep data associated with MKAnnotation from being lost after a callout pops up and user taps disclosure button?

前提是你 提交于 2019-11-26 21:07:16
How do I keep data associated with an MKAnnotation object after the user taps the pin, sees a callout, and taps the disclosure button which opens a detailed view controller? I want to display all data associated with the pin in the detail view controller. I have a simple MKAnnotation class that looks like: #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface VoiceMemoryAnnotation : NSObject <MKAnnotation> { NSString * blobkey; } @property (nonatomic, retain) NSString * blobkey; -(id)initWithBlobkey:(NSString *) key andCoordinate:(CLLocationCoordinate2D) c; @end I implemented