mkmapview

adding multiple circles around a pin in iOS

扶醉桌前 提交于 2019-12-11 09:31:31
问题 How can I add and display multiple circles in different colors inside a map ( MKMapView )? I figured out how to add one circle, but can't figure out how to add multiple circles in various sizes and colors ... any help would be appreciated! 回答1: Here's some code I use to draw two concentric circles at a given location on the map. The outer one is gray, and the inner one is white. (in my example "range" is the circle radius) Both have some transparency: - (void)drawRangeRings:

map annotation with different marker using swift 3

柔情痞子 提交于 2019-12-11 08:48:20
问题 I am working in map view annotation. The marker annotation should be displayed using the parking rule type If paid pin image be "paid" and if free pin image be "free" I am getting all annotation as "paid" image I have attached my code below can any one help me in this issue to fix func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { // Don't want to show a custom image if the annotation is the user's location. guard !(annotation is MKUserLocation) else {

MapKit Rendering Issues

社会主义新天地 提交于 2019-12-11 08:02:23
问题 So I have an application that draws a polyline on the map depending on the speed of the user, but I have some issues with it. Firstly, sometimes a large amount of the line is one colour even though given speed variations it should be changing. Secondly, if the user moves the map around or zooms, then the whole line goes red. And finally, I get this weird dot that looks like it is something to do with rendering? http://imgur.com/a/o5AKf Pretty new to programming so it might be really obvious!

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) {

Blurry UILabel text in accessory view of MKAnnotationView

落爺英雄遲暮 提交于 2019-12-11 06:56:35
问题 I'm trying to add a UILabel to an MKAnnotationView as a leftCalloutAccessoryView right after a pin got selected for the first time in the MKMapView. Adding the label is not a problem: The callout gets selected and opens, and this is when I add the label to the callout view. The callout gets automatically expanded to the left with a slide animation, and the new label including 2 lines is shown. Unfortunately I need to add the label after the Pin got selected because I need certain information

How to add a UIBezierPath to a MKMapView using overlays

一笑奈何 提交于 2019-12-11 06:56:02
问题 I 've been trying to add a half circle to a map view using a custom MKOverlayPathView subclass and a custom class which confirms to but I cannot get anything to show up on the map view. I use a UIBezierPath to create the path for the circle, but no matter what I try, I cannot see my path... Does anyone have an example program in which a UIBezierPath is being used as overlay? Thank you! Tim Edit: Answer to Anna's question: I can draw MKCircleViews without any problem, but I seem to struggle

Find distance between two points using MKMapKit

一笑奈何 提交于 2019-12-11 06:46:48
问题 I'm attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone OS 3.2. The problem is that I have these coordinates in terms of latitude and longitude, which, mathematically provides me enough data to find the distance, but it's going to take some tricky trigonometry. Is there any simpler solution? Thanks! 回答1: CLLocation has a method to calculate the distance for you: - (CLLocationDistance)distanceFromLocation:(const CLLocation *)location API docs

How to draw Polyline based on route in Mkmapview

心不动则不痛 提交于 2019-12-11 06:02:31
问题 Hi all I need to display Polyline in MKapview . I have done that but I need to show Polyline based on route. I'm getting like below image if am using location did update then it comes good i am try to store latitude and longitude then next time i have to displayed previous Polyline in that time i am not getting, please help me 回答1: - (void)drowRoautLines_FromLocation:(CLLocationCoordinate2D)FromLocation ToLocation:(CLLocationCoordinate2D)ToLocation { MKPlacemark *source = [[MKPlacemark alloc

MKPinAnnotationView loses pinColor after MKMapView zoom in

别等时光非礼了梦想. 提交于 2019-12-11 05:59:21
问题 I have a MKMapView with a lot of annotation pins defined from a parser xml; thats my code: -(IBAction)LoadAnnotation:(id)sender { RXML element ... RXML iterate.... [myMap removeAnnotations:myMap.annotations]; annotation.title = // NSString from RXML parser annotation.subtitle = // NSString from RXML parser myValue = // float value from RXML parser [mymap addAnnotation:annotation]; } and then - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation2

MKMapView overlapping MKAnnotations only allow showing two of the callouts

旧巷老猫 提交于 2019-12-11 05:58:00
问题 I have three MKPointAnnotation objects that are added in the exact same coordinates to an MKMapView and they are each given a unique title. MKPointAnnotation *a1 = [[MKPointAnnotation alloc] init]; a1.coordinate = CLLocationCoordinate2DMake(45.875684, -122.656254); a1.title = @"Title 1"; [self.mapView addAnnotation:a1]; MKPointAnnotation *a2 = [[MKPointAnnotation alloc] init]; a2.coordinate = CLLocationCoordinate2DMake(45.875684, -122.656254); a2.title = @"Title 2"; [self.mapView