mkannotation

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

≡放荡痞女 提交于 2019-11-26 11:14:37
问题 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

Swift - Add MKAnnotationView To MKMapView

痞子三分冷 提交于 2019-11-26 10:58:34
问题 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

MKMapView MKPointAnnotation tap event

耗尽温柔 提交于 2019-11-26 10:23:28
问题 I have a list of annotations (MKPointAnnotation). I have a UIViewController which is for the whole view, MKMapView implementing Controller, which I thought is useful for detecting the users interaction with the map, my own MKPointAnnotation implementing (subclass) Controller which tells how to show the annotation. However I\'m struck at the detection of the tap event by the user. Googling told me that I have to do something by implementing the following function. - (void)mapView:(MKMapView *

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

给你一囗甜甜゛ 提交于 2019-11-26 07:49:27
问题 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 *

Multiple annotation callouts displaying in MKMapView

陌路散爱 提交于 2019-11-26 07:47:59
问题 Is it possible to open simultaneously more then one callout? The code: - (void)mapViewDidFinishLoadingMap:(MKMapView *)theMapView { for (id<MKAnnotation> currentAnnotation in theMapView.annotations) { [theMapView selectAnnotation:currentAnnotation animated:YES]; } } opens only one callout. 回答1: Note that there is a method on MKMapView (not MKAnnotationView ) for selecting an annotation programmatically that works more or less as you would expect: - (void)selectAnnotation:(id < MKAnnotation >

How to create Custom MKAnnotationView and custom annotation title and subtitle

会有一股神秘感。 提交于 2019-11-26 07:34:09
问题 I need to create above Annotation view on MKMapView. I am able to create the custom annotation view but on the tap of annotation the view need to be opened image with that big text, I am not able to create that one. Please provide me some links or the way to do this task. 回答1: To create a custom annotation view (your replacement for the standard pin), you can just set the image property of the MKAnnotationView in the viewForAnnotation method: - (MKAnnotationView *)mapView:(MKMapView *)mapView

How to add more details in MKAnnotation in iOS

痴心易碎 提交于 2019-11-26 06:37:28
问题 I want to add more details in MKAnnotation like location title, description, date, location name. So it will be four lines that are needed. But I found that only 2 parameters can be passed to MKAnnotation which are title and subtitle. How can I add more details on the map? Plz help me..Thanks in advance. 回答1: Take a look at creating a custom MKAnnotationView object... it is basically a UIView that is tailored for map annotations. In that object you could have your 4 custom labels. In your

How to recognize which pin was tapped

醉酒当歌 提交于 2019-11-26 04:51:55
问题 I got an app with MKMapView and large number of pins on this map. Every pin got rightCalloutAccessoryView . I create it in this way: UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView.rightCalloutAccessoryView = rightButton; How should i know, which pin was tapped? Thnx 回答1: In the showDetails: method, you can get the pin tapped from the map view's

MKMapView: Instead of Annotation Pin, a custom view

我只是一个虾纸丫 提交于 2019-11-26 02:51:22
问题 I want to display an image in my MKMapView instead of little rock pin . Can someone please put some helpful code here, or tell the way how to do it? Thanks! EDIT -(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation { MKPinAnnotationView *pinView = nil; if(annotation != mapView.userLocation) { static NSString *defaultPinID = @\"com.invasivecode.pin\"; pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID]; if