mapkit

Z-index of iOS MapKit user location annotation

跟風遠走 提交于 2019-11-28 17:50:36
I need to draw the current user annotation (the blue dot) on top of all other annotations. Right now it is getting drawn underneath my other annotations and getting hidden. I'd like to adjust the z-index of this annotation view (the blue dot) and bring it to the top, does anyone know how? Update: So I can now get a handle on the MKUserLocationView, but how do I bring it forward? - (void) mapView:(MKMapView *)aMapView didAddAnnotationViews:(NSArray *)views { for (MKAnnotationView *view in views) { if ([[view annotation] isKindOfClass:[MKUserLocation class]]) { // How do I bring this view to the

How to move a MKAnnotation without adding/removing it from the map?

佐手、 提交于 2019-11-28 17:48:33
Is it possible to move the coordinate of a MKAnnotation without adding and removing the annotation from the map? I found a pretty simple method. I wanted to update my player's position smoothly without removing and then re-adding the player annotation. This works well for pre-iOS4 apps, and what it does is both move the pin and center the map on the pin's new location: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [player setCoordinate:aLoc.coordinate]; [mapView setCenterCoordinate:aLoc.coordinate animated

iOS MapKit custom pins

删除回忆录丶 提交于 2019-11-28 17:37:41
How do I show images instead of pins in the map. So far I can only add pins on tap. A sample code of the .m would extremely help since i'm still new to iOS programming. Robin #pragma mark - #pragma mark MKMapView delegate - (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier]; if(annotationView) return

detect if a point is inside a MKPolygon overlay

元气小坏坏 提交于 2019-11-28 17:18:22
I want to be able to tell if tap is within a MKPolygon. I have a MKPolygon: CLLocationCoordinate2D points[4]; points[0] = CLLocationCoordinate2DMake(41.000512, -109.050116); points[1] = CLLocationCoordinate2DMake(41.002371, -102.052066); points[2] = CLLocationCoordinate2DMake(36.993076, -102.041981); points[3] = CLLocationCoordinate2DMake(36.99892, -109.045267); MKPolygon* poly = [MKPolygon polygonWithCoordinates:points count:4]; [self.mapView addOverlay:poly]; //create UIGestureRecognizer to detect a tap UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget

I want to get the Location name from the Coordinate value in MapKit for iPhone

三世轮回 提交于 2019-11-28 17:16:24
I want to get the location name from the coordinate value. Here is code, - (void)viewWillAppear:(BOOL)animated { CLLocationCoordinate2D zoomLocation; zoomLocation.latitude = 39.281516; zoomLocation.longitude= -76.580806; MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE); MKCoordinateRegion adjustedRegion = [_mapView regionThatFits:viewRegion]; [_mapView setRegion:adjustedRegion animated:YES]; } So, From that Latitude and longitude , i want to know that location name. The Below code shall work in ios5 and above CLGeocoder

iOS Swift MapKit Custom Annotation [closed]

拟墨画扇 提交于 2019-11-28 16:26:25
I am having some trouble getting a custom annotation to load inside of my map view when I try to place a pin. import UIKit import MapKit import CoreLocation class MapViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate{ @IBAction func ReportBtn(sender: AnyObject) { //MARK: Report Date And Time Details let ReportTime = NSDate() let TimeStamp = NSDateFormatter() TimeStamp.timeStyle = NSDateFormatterStyle.ShortStyle TimeStamp.dateStyle = NSDateFormatterStyle.ShortStyle TimeStamp.stringFromDate(ReportTime) //MARK: Default Point Annotation Begins let ReportAnnotation =

How do i open Google Maps for directions using coordinates on the iphone

萝らか妹 提交于 2019-11-28 16:14:42
I am using UIMapView to display locations on the iPhone. I want to do a directions from current location to the location of interest, I don't think its possible using MapKit (but if it is please inform) So I will open either the Google Maps application or safari to display it. Can i do this by specifying co-ordinates from (current location) to co-ordinates (the location of interest) I have these longitudes and latitudes. Or do i have to use street addresses? If I do have to use street addresses, can i get them from the latitude and longitude. iGo It is possible.Use MKMapView Get the location

iPhone Map Kit cluster pinpoints

家住魔仙堡 提交于 2019-11-28 16:14:23
Regarding iPhone Map Kit cluster pinpoints: I have 1000's of marks that I want to show on the map but it's just too many to handle so I want to cluster them. Are there frameworks available or proof of concepts? That this is possible or is already been done? Andy Jacobs You can use REVClusterMap to cluster Note: This is a commercial product I'm affiliated with, but it solves this very problem. I solved this problem in few of my apps and decided to extract it into a reusable framework. It's called Superpin and it is an (commercial, license costs $149) iOS Framework that internally uses quadtrees

What's the best way to zoom out and fit all annotations in MapKit

空扰寡人 提交于 2019-11-28 16:07:33
Quick background of what I have going on. UIMapView loads and shows a single annotation (Never more than one). On the menu bar, there is a Locate Me button, on tap the userLocation is found and displayed as a second annotation. I then I have MapView zoom out to fit both those annotations in range but I am unable to find a suitable way of doing so. Depending on where the first annotation is placed in relation to the user location, sometimes it doesn't zoom out enough. For example, if the annotation is North West of the User, it zooms out fine. But if the annotation is South East of the User, it

How to detect taps on MKPolylines/Overlays like Maps.app?

吃可爱长大的小学妹 提交于 2019-11-28 15:50:12
问题 When displaying directions on the built-in Maps.app on the iPhone you can "select" one of the usually 3 route alternatives that are displayed by tapping on it. I wan't to replicate this functionality and check if a tap lies within a given MKPolyline. Currently I detect taps on the MapView like this: // Add Gesture Recognizer to MapView to detect taps UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapTap:)]; // we require all gesture