mapkit

iOS MapKit Annotation, not showing correct location

拜拜、爱过 提交于 2019-12-06 06:56:58
问题 I using a custom image for my mapkit annotation. But the main problem it seems that I am running into in using a custom image, is that when zoomed out, the annotation is not in the correct point on the map, and ONLY until I zoom in all the way down, will it show the annotation point in the correct place. It seems that when I use a regular pin MKPinAnnotationView , it works normally, as with the pin being in the correct place zoomed in or out, thanks in advance for anyone that can help. The

MapKit multiple pins same coordinates, different info selection

家住魔仙堡 提交于 2019-12-06 06:39:32
问题 I have the following situation: - 3 pins with same coordinates but different title and info - on map there is ony one pin It is possible to tap multiple times on that pin and the annotation displayed to be: - first tap -> the annotation for pin 1 - second tap -> the annotation for pin 2 - third tap -> the annotation for pin 3 - fourth tap -> the annotation for pin 1 Do you have any ideas how should I implement it? 回答1: You can implement the didSelectAnnotationView delegate method and select

Draw a polyline between two coordinates in Xcode

若如初见. 提交于 2019-12-06 06:20:52
I would like to draw a POLY-LINE between two or more given coordinates on the map(poly-line and not the route). Imagine I have 2 dropped pins on the map and I need to draw a straight line from the first dropped pin to the second dropped pin. In Interface file MKPolyline* _routeLine; MKPolylineView* _routeLineView; In Implementation file Store all the coordinates in NSMutablrArray *routeLatitudes then MKMapPoint* pointArr = malloc(sizeof(CLLocationCoordinate2D) * [routeLatitudes count]); for(int idx = 0; idx < [routeLatitudes count]; idx++) { CLLocationCoordinate2D workingCoordinate;

Identify MKPointAnnotation in mapView

无人久伴 提交于 2019-12-06 05:52:41
问题 I have at least 100 diferents Points ... how can associate each point with the position in my 'listOfPoints' assigning a tag in the position associated in viewForAnnotation . Here i add my Points, some events will have the same title. var listOfPoints : Array<Events> = [] // List Of all events //add points to map for (index, mPoints) in enumerate(listOfPoints) { var point: MKPointAnnotation! = MKPointAnnotation() var location = CLLocationCoordinate2D(latitude: mPoints.latitude, longitude:

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

MKPolygon - How to determine if a CLLocationCoordinate2D is in a CLLocationCoordinate2D polygon?

本小妞迷上赌 提交于 2019-12-06 05:03:31
I have the swift code below that draws a polygon and drops an annotation on MKMapView. I am trying to figure out how i could identify if the annotation's coordinate is within the polygon? import UIKit import MapKit class ViewController: UIViewController { @IBOutlet weak var mapView: MKMapView! override func viewDidLoad() { super.viewDidLoad() let initialLocation = CLLocation(latitude: 49.140838, longitude: -123.127886) centerMapOnLocation(initialLocation) addBoundry() var annotation = MKPointAnnotation() annotation.coordinate = point1 annotation.title = "Roatan" annotation.subtitle = "Honduras

MapView detect scrolling

筅森魡賤 提交于 2019-12-06 04:42:51
问题 I'm wishing that MKMapView inherited from UIScrollView just like UITableView and UICollectionView are. This way you can override the UIScrollView delegate methods and do what you need to do. I've found the method of attaching a pan gesture to the MapView like so: UIPanGestureRecognizer* mapPanGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mapPanGestureHandler:)]; [mapPanGestureRecognizer setDelegate:self]; [self.mapView addGestureRecognizer

How to get location name using mapkit in iphone?

人盡茶涼 提交于 2019-12-06 04:36:09
I am new in iphone development and right now i am facing problem for developing developing an application in which i need to get coordinate(lat, long) when user tapped on screen for two second and also get user location name,i got coordinate but i am unable to get user location name on which user tapped. so kindly help me on that? In iOS 5+ use CLGeocoder and its reverseGeocodeLocation:completionHandler: method. In your case, you're probably most interested in the areasOfInterest property. Example: CLGeocoder* gc = [[CLGeocoder alloc] init]; double lat, lon; // get these where you will [gc

How to overlay a circle on an iOS map

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 03:49:22
问题 I've got a radius and a location. This is how I'm trying to get the bounding rectangle of the circle. - (MKMapRect)boundingMapRect{ CLLocationCoordinate2D tmp; MKCoordinateSpan radiusSpan = MKCoordinateRegionMakeWithDistance(self.coordinate, 0, self.radius).span; tmp.latitude = self.coordinate.latitude - radiusSpan.longitudeDelta; tmp.longitude = self.coordinate.longitude - radiusSpanSpan.longitudeDelta; MKMapPoint upperLeft = MKMapPointForCoordinate(tmp); MKMapRect bounds = MKMapRectMake

How to find out pin id in map annotation view?

大城市里の小女人 提交于 2019-12-06 03:45:55
问题 How can I find out the pin id (i.e. the details of pin title and subtitle) of pin that was clicked? I have this to show pins annotations. This code is in view did load: [resultCoordinate addObjectsFromArray:[sqlClass return_Coordinate]]; if ([resultCoordinate count]) { for (int i =0; i < [resultCoordinate count]; i++) { dict = [resultCoordinate objectAtIndex:i]; MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; region.center.latitude = [[dict objectForKey:@"Lati"] floatValue]; region