mkannotation

I have 30 annotations, and growing. Looking for a simpler way to code this?

北城余情 提交于 2019-12-05 02:20:26
问题 I am coding multiple annotations into a project. Currently I have 30 annotations, and growing. I'm wondering if there is a simplier way of having to create a annotation.h and annotation.m classes for each single annotation. Currently in my map view controller, I create the annotation objects and place them in an array, which has been working well for me but as you could imagine, its a lot of code to manage once you have tons of annotations, not to mention tons of classes. So for example, one

How to create an NSMutableArray and assign a specific object to it?

左心房为你撑大大i 提交于 2019-12-05 01:45:32
I am just getting into Obj C, and I am looking to create an array of MKAnnotations. I have already created the MKAnnotation class called TruckLocation that contains the name, description, latitude, and longitude. Here is what I have so far for the array: NSMutableArray* trucksArray =[NSMutableArray arrayWithObjects: @[<#objects, ...#>] nil]; Wain Yore trying to combine 2 different syntaxes for similar but different things. You also don't seem to have any instances of your annotations. Create some instances TruckLocation *a1 = ...; TruckLocation *a2 = ...; Then we can add them NSMutableArray

setting canShowCallOut = NO for current location annotation, iPhone

一世执手 提交于 2019-12-04 23:20:14
I am using custom call out (title and subtitle)for Current location icon. I tried following to disable default annotation but it does not work. - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { NSLog(@"viewForAnnotation"); if ([annotation isKindOfClass:[MKUserLocation class]]) { MKAnnotationView *userLocationView = [mapView viewForAnnotation:annotation]; userLocationView.canShowCallout = NO; NSLog(@"[annotation isKindOfClass:[MKUserLocation class]"); return nil; } } Only way it works is -(void)mapView:(MKMapView *)mapView

Open Map Annotation from Selected Row in Table View

*爱你&永不变心* 提交于 2019-12-04 22:10:30
I have a map view in one class with all of my annotations with titles and subtitles. There is a nav bar button that shows a list of all of those titles and subtitles. I'm wanting to be able to select a row in the table view and have it open the annotation with the same title in the map view. Any help? The only problem I have now is getting the annotation to show when the map view opens. I know I need to use selectAnnotation: animated: but I'm having trouble figuring out how to tell it to open the annotation with the matching title. In RSFM (class with map view named worldView) I show the table

how can I center my map on the annotation view only when it is close to the edge of the screen?

落花浮王杯 提交于 2019-12-04 20:30:41
In my swift application I'm using MapKit and I'm adding some annotations to the map. Currently, thanks to this question: Trying to get the span size in meters for an iOS MKCoordinateSpan I managed to create a functionality that centers my map on the annotation when user presses it. This is the code for it: let span = mapView.region.span let centerView = mapView.region.center let loc1 = CLLocation(latitude: centerView.latitude - span.latitudeDelta * 0.5, longitude: centerView.longitude) let loc2 = CLLocation(latitude: centerView.latitude + span.latitudeDelta * 0.5, longitude: centerView

Issue with overlapping annotations (MKAnnotationView) on map

蓝咒 提交于 2019-12-04 18:49:26
问题 In my iphone application, I'm using MapKit with MKMapView and custom MKAnnotationView. The problem is when annotations overlap on map (in my app, annotations are photos and those photos may overlap) and when you tap on the annotation that appears on front, it's another annotation (on back) which receives the event (seems to be random). I didn't find any way to send the event to the front annotation. I cannot believe this bug/problem doesn't have any solution! Z ordering and Order of

MapKit update annotation image

女生的网名这么多〃 提交于 2019-12-04 17:17:06
I'm having a problem finding out the way to update a custom MKAnnotationView image after a asynchronous request completes with information about the status of the annotation. So far, I have this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"EstacionEB"; if ([annotation isKindOfClass:[EstacionEB class]]) { EstacionEB *location = (EstacionEB *) annotation; CustomPin *annotationView = (CustomPin *) [_mapita dequeueReusableAnnotationViewWithIdentifier:identifier]; if (annotationView == nil) { annotationView = [

Different font for MKAnnotationView

匆匆过客 提交于 2019-12-04 15:44:46
问题 On the callout bubble on the iPhone SDK's map, can the font be changed for the title and subtitle properties. I am displeased with the default font shown in the callout bubble, and would like to go with a different font face to match the rest of my application. However, I have not seen much mention of this, which has me concerned that it might not be possible. I have seen the Building Custom Map Annotation Callouts tutorial, and I guess that would work. But, if at all possible I was hoping

mkmapview MKUserLocation AnnotationView

我与影子孤独终老i 提交于 2019-12-04 14:58:51
I'm trying to create custom annotationviews for the annotations on my map. I'm doing that by adapting the protocol MKMapViewDelegate and overwriting the function mapView:viewForAnnotation: . It all works, the only problem is that I also have showsUserLocation set to TRUE , which means that one "Annotation" I get in my mapView:viewForAnnotation: method is of the class MKUserLocation . I don't want the userlocation annotation to have my custom annotationview, I want that one to show the default userlocation annotationview! How do I return the default userlocation annotationview for the

Swift - Perform Segue from map annotation

二次信任 提交于 2019-12-04 14:44:37
I have 1 pin on my map. I need to pass title of annotation to another UIView (which is ikinciEkran.swift in that case). But I am unable to do so. Here is the segue part of my code and I do not know how to segue title of selected annotation. I only pasted related part of the code. class MapViewController: UIViewController, CLLocationManagerDelegate, MKMapViewDelegate { @IBOutlet weak var mapView: MKMapView! @IBOutlet weak var lbl_Name: UILabel! @IBOutlet weak var lbl_Address: UILabel! @IBOutlet weak var lbl_Phone: UILabel! var LocationManager = CLLocationManager() var i = 0 var annotation