mapkit

How to disable user interaction on MKMapView?

余生长醉 提交于 2019-11-27 01:36:29
问题 How do you disable user interaction to an entire Map (MKMapView) in iOS? I just want to disable zooming, tapping, etc and show a static map. [self.mapView setUserInteractionEnabled:NO] didn't work. Found no working solutions via Google or other answers here on Stack (pls link if you find a working answer..) . Targeting iOS 5. There should be an easier way to do this. 回答1: The key is to disable zooms and scrolls, such as: self.mapView.zoomEnabled = false; self.mapView.scrollEnabled = false;

iOS6 Simulator MKMapKit “Couldn't find default.styleproto in framework”

眉间皱痕 提交于 2019-11-27 01:30:09
问题 Running my app with the iOS6 simulator I am getting the following printed in the XCode console prior to viewDidLoad getting called: Couldn't find default.styleproto in framework Has anyone else encountered this, and if so have you found a reason why? My guess is that it has to do with the iOS6 Apple Maps, but who knows! EDIT I should add that I don't get this warning in the iOS 5.1 simulator. 回答1: I found a way to consistently reproduce this. First, the culprit is a set of files in the Cache

How to draw a route between two locations using MapKit in Swift?

故事扮演 提交于 2019-11-27 01:11:32
问题 How can I draw a route between user's current location to a specific location using MapKit in Swift? I searched a lot, but didn't find any helpful Swift-specific links or tutorials. 回答1: Swift 4 class MapController: UIViewController, MKMapViewDelegate { // MARK: - showRouteOnMap func showRouteOnMap(pickupCoordinate: CLLocationCoordinate2D, destinationCoordinate: CLLocationCoordinate2D) { let sourcePlacemark = MKPlacemark(coordinate: pickupCoordinate, addressDictionary: nil) let

Annotation along route in MapKit

天大地大妈咪最大 提交于 2019-11-27 01:10:53
问题 I'm using MapKit to display directions between locations, and I'm looking for a way to add an annotation that works similarly to the route annotation in the Apple Maps app, where annotations are showing each route's travel time (as shown in the image below). I am already drawing the directions correctly, the problem at hand is how to calculate a pair of coordinates along the route. That is, where to drop the annotation. I thought about somehow using the MKDirection (which contains complete

Is the Current Location/Compass heading button available in the iOS sdk?

与世无争的帅哥 提交于 2019-11-27 01:08:54
问题 I am working on a sample map kit app for iOS. I have everything working and a toolbar button to toggle the MKUserTrackingMode. This may seem like a silly question but I have searched all the options in the IB and looked in the documentation, and I can't find any button options like the one for the current location/compass heading used in the iOS Maps app. Is that particular button available to developers? 回答1: You need to create a MKUserTrackingBarButtonItem and pass it the MKMapview in the

Custom MKPinAnnotation callout bubble similar to default callout bubble

那年仲夏 提交于 2019-11-27 01:04:25
i want to create a custom callout bubble on MKMapView. But i want to create the call out bubble in the same manner of default bubble. So how to create a View look like annotaion in this image (source: objectgraph.com ) I want a custom custom view which look like "Parked Location" annotaion in the following image. with custom width, height etc. P I am not able to add required details in Default bubble. Thats why am creating custom bubble. Plz help me..thanks.. I have developed a custom callout bubble that is nearly identical to the system callout bubble, but gives more flexibility over the

Gradient Polyline with MapKit ios

a 夏天 提交于 2019-11-27 00:47:06
I'm trying to trace a route on a MKMapView using overlays (MKOverlay). However, depending on the current speed, I want to do something like the Nike app with a gradient while tracing the route, if the color is changing (for example, from green to orange if a user is driving from 65mph to 30mph). Here's a screenshot of what I want: So every 20 meters, I adding an overlay from the old to the new coordinates using: // Create a c array of points. MKMapPoint *pointsArray = malloc(sizeof(CLLocationCoordinate2D) * 2); // Create 2 points. MKMapPoint startPoint = MKMapPointForCoordinate

Z-ordering of MKAnnotationViews

橙三吉。 提交于 2019-11-26 22:58:11
问题 I'm getting fairly frustrated with the limitations of MKMapKit. My current problem has to do with the z-ordering of annotation views, particularly as it relates to touches. If you accept the default z-order the mapkit gives you: The order appears random. The z-order is unrelated to the order the annotations were added. If one annotation ends up on top of another one, touching the top annotation generally brings up the callout for the bottom annotation. It seems like the hit detecting doesn't

Wanted: How to reliably, consistently select an MKMapView annotation

杀马特。学长 韩版系。学妹 提交于 2019-11-26 22:40:01
问题 After calling MKMapView 's setCenterCoordinate:animated: method (without animation), I'd like to call selectAnnotation:animated: (with animation) so that the annotation pops out from the newly-centered pushpin. For now, I simply watch for mapViewDidFinishLoadingMap: and then select the annotation. However, this is problematic. For instance, this method isn't called when there's no need to load additional map data. In those cases, my annotation isn't selected. :( Very well. I could call this

How to keep data associated with MKAnnotation from being lost after a callout pops up and user taps disclosure button?

前提是你 提交于 2019-11-26 21:07:16
How do I keep data associated with an MKAnnotation object after the user taps the pin, sees a callout, and taps the disclosure button which opens a detailed view controller? I want to display all data associated with the pin in the detail view controller. I have a simple MKAnnotation class that looks like: #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface VoiceMemoryAnnotation : NSObject <MKAnnotation> { NSString * blobkey; } @property (nonatomic, retain) NSString * blobkey; -(id)initWithBlobkey:(NSString *) key andCoordinate:(CLLocationCoordinate2D) c; @end I implemented