mkannotation

Swift -How to Update Data in Custom MKAnnotation Callout?

本小妞迷上赌 提交于 2019-12-11 11:45:24
问题 I have a custom annotation for my mapView. I initially set the coordinate, title (eg. "first title"), subTitle (eg. "first address"), userId, and a distance (eg. 0 meters) property on it with some data. I add it to the mapView and to an array for later use. Everything works, it shows on the mapView, I press it and the callout shows that initial data. I later get updated that the location for that callout has changed. I loop through the array and update the callout with new data for the

Adding Multiple Annotations to Map View Not Working

时光怂恿深爱的人放手 提交于 2019-12-11 07:36:36
问题 So I have successfully added a single annotation to the map view with a custom image, however if I add a second annotation it merely refuses to display on the map. Here is the relevant code: - (void)viewDidLoad { [super viewDidLoad]; //mapView = [[MKMapView alloc] initWithFrame:self.view.bounds]; mapView.delegate = self; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Location Info" style:UIBarButtonItemStylePlain target:self action:nil]; self.navigationItem

MKMapView iOS custom user location Annotation not showing/updating position

喜夏-厌秋 提交于 2019-12-11 07:20:07
问题 Hi I am using a custom annotation in replacement of the blue GPS position dot. I have added it to the map like so in the viewForAnnotation. OurLocAnnotation class conforms to MKAnnotation delegate. //Custom location view if([annotation isKindOfClass:[OurLocAnnotation class]]) { static NSString *identifier = @"currentLocation"; SVPulsingAnnotationView *pulsingView = (SVPulsingAnnotationView *)[self.recycleMap dequeueReusableAnnotationViewWithIdentifier:identifier]; if(pulsingView == nil) {

iOS : App crashes when zooming out a map

时间秒杀一切 提交于 2019-12-11 07:14:52
问题 I have this situation where my app crashes when I zoom out the map. The problem arises because of the large number of annotations that I'm adding. Please have a look at my code below : - (void) plotUsersInMap { for (id<MKAnnotation> annotation in self.mapView.annotations) { [self.mapView removeAnnotation:annotation]; } NSUInteger count = //get total count NSLog(@"count * %d", count); for (int i = 0; i < count; i++) { NSNumber *latitude = //get latitude from json NSNumber *longitude = //get

My annotations doesn't show the Sub Title in the PIN

…衆ロ難τιáo~ 提交于 2019-12-11 07:14:26
问题 in the implementations class charged of displaying PINS, i have reserved two variables (title and sub title), in this example, only the word USA (the title) is displayed when i click on the PIN. CLLocationCoordinate2D location2D = (CLLocationCoordinate2D){ .latitude = latitudeOfUserLocation, .longitude = longitudeOfUserLocation }; ManageAnnotations *annotation=[[ManageAnnotations alloc]initWithTitle:@"USA" adresseDuTheme:@"Colorado" coordinate:location2D];//only USA is displayed annotation

iPhone - Updating Annotation subtitle in mapkit

陌路散爱 提交于 2019-12-11 05:06:30
问题 I have a custom placemark with title and subtitle. The subtitle is actually displaying the address of the dropped pin using the reverse geocoder. I have a button which has an action to drop the pin. This action gets the location coordinates of the user, and then calls [geocoder start] which gets the full address with Reverse Geocoder and generates the custom annotation and then calls [mapView addAnnotation:customPlacemark]. My problem is that using this sequence order, when there's no a WiFi

Add extra detail to MKPointAnnotation other than title and subtitle

混江龙づ霸主 提交于 2019-12-11 04:31:26
问题 I wish to pass informations from a Pin annotation to another viewController.I can pass the title and subtitle of the annotation but I need to pass some extra information along with these. Is there a way to add extra information to a MKPointAnnotation other than just title and subtitle? here I have the pin title and subtitle set so it appears on the map: var zoopin = MKPointAnnotation() zoopin.coordinate = zoo zoopin.title = "The zoo" zoopin.subtitle = "hello this is the zoo" mapView

How to display several MKPinAnnotation with same Latitude / Longitude?

落花浮王杯 提交于 2019-12-11 04:02:28
问题 My iPad App is retrieving geographical objects from a database. In this database some objects have the same longitude / Latitude. As a consequence in the MkMapView I'm adding several MKPinAnnotation with the same Lat/Long. Unfortunately only one is displayed, I suppose it the last one I have added. How can I have only one MKPinAnnotation object (for a given coordinate) and when user clicks on it I will display MKPinAnnotation for each objects sharing the same coordinates? Something similar to

Is it possible to force MapKit to show all annotations without clustering?

╄→гoц情女王★ 提交于 2019-12-11 02:19:36
问题 I have two classes that both conform to MKAnnotation , and I was wondering, is there a way to force MapKit to not cluster the annotation when a user zooms out and display all annotations? 回答1: Set MKAnnotation's clusteringIdentifier to nil. e.g. class BikeView: MKMarkerAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has

Setting Map Pin colour dynamically for iOS

泄露秘密 提交于 2019-12-11 01:59:41
问题 I parse an xml that contains the string 0 ,1 and 2. //For reference 0 = Green 1 = Red 2 = Purple I have a class that confirms to the MKAnnotaion that contains the below variables that are properties. CLLocationCoordinate2D coordinate; NSString *title; NSString *subtitle; MKPinAnnotationColor pinColor; This class is named MyAnnotation Now in the viewDidLoad of the map view I run a for loop to iterate over the parsed data like the below (locationArray holds this data and I pull out all the info