mkannotation

setting canShowCallOut = NO for current location annotation, iPhone

谁都会走 提交于 2019-12-06 17:36:50
问题 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

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

梦想与她 提交于 2019-12-06 12:54:23
问题 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

Draw MKPointAnnotation with title in MKSnapshot image

六眼飞鱼酱① 提交于 2019-12-06 11:55:09
I'm trying to draw an annotation exactly as in a 'live' MapView, but then in a MKSnapshot. Why an MKSnapshot > because I want to have non-interactive MapViews in a UITableView and using images is more efficient. I can get a pin to be drawn (though not a point as in iOS 11, the pin looks old) using MKPinAnnotationView, but also then there is no title of the annotation on the image. Using almost exactly this code: Snapshot of MKMapView in iOS7 . You can use the following steps: with MKMapSnapshotter you will get an image of the map without annotations you can retrieve the annotations from your

Setting image for MKAnnotation

点点圈 提交于 2019-12-06 11:51:52
I added MKAnnotation in my mapview using the following code. Flag *flag = [[Flag alloc] init]; flag.title = @"Golf Course"; flag.subtitle = @"Green"; flag.coordinate =CLLocationCoordinate2DMake(28.457394,77.108667); [mapView addAnnotation:flag]; and am setting image like -(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation { if(([annotation isKindOfClass:[Flag class]])) { MKPinAnnotationView *pinView = nil; if(annotation != mapView.userLocation) { static NSString *defaultPinID = @"PinId1"; pinView = (MKPinAnnotationView *)[mapView

MapKit update annotation image

对着背影说爱祢 提交于 2019-12-06 09:47:36
问题 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

Swift - Perform Segue from map annotation

青春壹個敷衍的年華 提交于 2019-12-06 07:15:43
问题 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!

MapView with clusters: how to display multiple annotations on same view

馋奶兔 提交于 2019-12-06 07:06:46
I have integrated FBAnnotationClustering on mkmapview which works perfectly, but when there is more than one annotation at exactly the same place I cannot display the annotationView with the correct informations. I'm trying to loop through the annotations and display them in the same view (each with a callout button to display more info). So far I managed to make one callout work to display the details at the bottom, but in the annotationView it displays it without the right title, and there is just one so it's not exactly useful. So I'm wondering, is it possible to display multiple

Swift - setting rounded corners to annotation view image

不想你离开。 提交于 2019-12-06 07:01:38
问题 Here is my previous thread, where I set image to annotation view pins Swift - setting different images from array to annotation pins Right now I encountered a problem with setting rounded corners on annotation view image. cannot show callout with clipsToBounds enabled swift appears that I have to choose between rounded corners or showing callout, I don't really get why these two can't come along. Is there any way to do that? Here is my viewForAnnotation function: func mapView(mapView:

MapKit Display Annotation Clusters and Along With Non-Clustered Annotations

。_饼干妹妹 提交于 2019-12-06 05:27:37
I am new to iOS development and currently using the FBAnnotationClusteringSwift to cluster makers. My app needs to have two annotations which will not be clustered, as they indicate the source and destination addresses. The remaining annotations must be clustered as they represent stations . What I want to achieve is something like the image bellow, where "A" is my source address, and the clusters represent stations: However what is happening is, as the clusters are created , the Annotation that represents a non-clustered annotation (the source address) disappears as following: If the library

How to change default background color of callout bubble with detailCalloutAccessoryView

佐手、 提交于 2019-12-06 04:43:30
问题 In my app I have the following sutuation. I've implemented a custom callout bubble with custom detailCalloutAccessoryView with two labels inside. I know how to change the color of detailCalloutAccessoryView with this line. view.detailCalloutAccessoryView?.backgroundColor = UIColor.red But I can't figure out how to change background color of the main bubble (it is transparent grey/white now). With view.detailCalloutAccessoryView?.backgroundColor = UIColor.red line my calloutbubble looks like