mkannotation

Multiple annotation callouts displaying in MKMapView

三世轮回 提交于 2019-11-26 21:04: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. 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 >)annotation animated:(BOOL)animated However, it automatically deselects any currently annotation at the same

How to create Custom MKAnnotationView and custom annotation title and subtitle

好久不见. 提交于 2019-11-26 20:17:39
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. Rob 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 viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]

Move the annotation on Map like Uber iOS application

妖精的绣舞 提交于 2019-11-26 18:56:09
问题 I am working on a project where I need to create the similar iOS application to UBER and OLA where the car is moving based on the location. I'm looking for some kind of Library which can make Cars move and take turn smoothly just like OLA. For now I was able to move car from one latitude-longitude to another. But the complex part is how to turn and make sure the car face to front when moving to direction. Please find the below screenshot for the same. 回答1: Actually I had also one requirement

How to add more details in MKAnnotation in iOS

不打扰是莪最后的温柔 提交于 2019-11-26 18:50:49
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. Ryan Ferretti 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 MKMapViewDelegate class, you implement the viewForAnnotation method: - (CustomMapAnnotationView *

MKAnnotation, simple example

不羁岁月 提交于 2019-11-26 18:14:31
问题 Is there a simple example project for MKAnnotation ? I don't know what to pass at " addAnnotation ", as it wants some " id<Annotation> ". The examples at the developer site are all with arrays or parsers or so, I just need a very easy example to first understand, how the whole thing works. Thanks in advance.. EDIT: I set up a class Pin . In the .h it writes #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface Pin : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate;

Store data in MKAnnotation?

旧街凉风 提交于 2019-11-26 17:55:39
So I'm pretty new to Xcode and Objective-C. I have several ArtPiece objects with various attributes stored in an array. I then add them as MKAnnotations to the mapview. What I need to be able to do is send a reference to the array position they came from on click. I believe MKAnnotations only have the data members title, image, and location, so when I make an MKAnnotation from the objects, the annotation does not keep any of the other attributes. So, my question is, how can I manage to keep a reference to the array position of the object the annotation was created from so that I can send it to

Tracking MKMapView centerCoordinate while panning

风格不统一 提交于 2019-11-26 16:47:28
问题 I'm implementing a map feature in my app where I allow the user to set their current location by panning around. All this time, I want to have an MKAnnotation in the centerCoordinate . So what I want to do is keep track of when the map's centerCoordinate changes and change the annotation's coordinate correctly. The behaviour would be similar to that of Uber , Hailo and others. I tried a time based implementation where every 0.00001s the centerCoordinate would be checked and the annotation

iPhone: Create MKAnnotation

谁说我不能喝 提交于 2019-11-26 16:09:07
问题 Can I create an MKAnnotation , or is it read only? I have coordinates, but I am not finding it easy to manually create an MKAnnotation with using setCoordinate . Ideas? 回答1: MKAnnotation is a protocol. So you need to write your own annotation object that implements this protocol. So your MyAnnotation header looks like: @interface MyAnnotation : NSObject<MKAnnotation> { CLLocationCoordinate2D coordinate; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; // add an init method

does MKAnnotationView buffer its input queue?

半腔热情 提交于 2019-11-26 14:50:03
问题 I want to display different colour pins in a UIMapView based on the relative time they represent but it seems the mapView:viewForAnnotation: method only does it's thing independent of when its called. In my code example I have already retrieved earlier & newer locations from a file to self.fileArray . the array holds objects called findings that has (among others) an age property . newest findings start life as age @"0", and each time the array is reloaded ready to take new findings they

MKMapView: Instead of Annotation Pin, a custom view

安稳与你 提交于 2019-11-26 12:10:00
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 ( pinView == nil ) pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier