mkmapview

MKMapView Clicking on pins won't call didSelectAnnotationView

点点圈 提交于 2019-12-18 08:31:22
问题 I am using a mapView and am trying to make a callout pop up when you click on a pin which is shown on the map. The pins manage to be placed in the proper locations so I think the annotations work but when I click on the pin it won't show a callout. I have show callout = YES. The method didSelectAnnotationView does not get called at all when I click on the pin. Are there some common problems which may cause this method not to be called? 回答1: If tapping on a pin doesn't show the callout even if

How to remove country/state names from MKMapview

旧街凉风 提交于 2019-12-18 07:05:33
问题 I want to remove country / state names from MKMapview in iPhone. Means I need only blank map view without any name on it. Is this possible with MKMapview or any other third party maps. I want to use this functionality with MKMapTypeStandard map type. 回答1: Have a look at MKMapViews property mapType MKMapTypeSatellite . Setting this type you will see a map without any names on it. See the docs: MkMapView Class Reference Code: self.map.mapType = MKMapTypeSatellite; 来源: https://stackoverflow.com

iOS - MKMapView showAnnotations:animated: with padding?

喜夏-厌秋 提交于 2019-12-17 23:43:37
问题 I want to be able to zoom my MKMapView to fit it's annotations. I have managed to do it using iOS7's showAnnotations method. But I would also like to add some padding or inset from the map view border. This is because I have a semi-transperant view that overlays the top part of my map, and I don't want annotations to be places behind this view. I have tried this: [self.mapView showAnnotations:annotations animated:YES]; [self.mapView setVisibleMapRect:self.mapView.visibleMapRect edgePadding

How to draw a MKPolyline on a MapView?

萝らか妹 提交于 2019-12-17 23:33:40
问题 I have an array of points to be drawn on a map, its already decoded: - (void) drawRoute:(NSArray *) path { NSInteger numberOfSteps = path.count; CLLocationCoordinate2D coordinates[numberOfSteps]; for (NSInteger index = 0; index < numberOfSteps; index++) { CLLocation *location = [path objectAtIndex:index]; CLLocationCoordinate2D coordinate = location.coordinate; coordinates[index] = coordinate; } MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:numberOfSteps]; [map

Custom pin image in annotationView in iOS

冷暖自知 提交于 2019-12-17 17:34:35
问题 I'm trying to change from Swift 1.2 to Swift 2.0 and I'm at the end of the changes. Currently I'm making changes in the MapViewController, and there isn't any error or warning, but the custom image for my pin (annotationView) it's not assigned to the pin and it's showing the default one (red dot). Here is my code, I hope you can help me with some tip because I think everything is fine but it's still not working: func parseJsonData(data: NSData) -> [Farmacia] { let farmacias = [Farmacia]() do

How to set accuracy and distance filter when using MKMapView

我的未来我决定 提交于 2019-12-17 17:28:28
问题 When i use setShowsUserLocation with MKMapView to track user location, how do I set the accuracy and distance filter? I am not talking about CLLocationManager . Thanks, 回答1: You can't control the accuracy of the internal MKMapView location manager (the one used to track the user with the blue dot), but you can create your own and use it to recenter the map. Here is a recipe... To handle core location permissions In the Core Location Delegate: - (void)locationManager:(CLLocationManager *

Pass Variables to a new View Controller via a Subclass and Dozens of Map Pins

余生长醉 提交于 2019-12-17 17:14:14
问题 I have a few moving parts in this one that I can't seem to stitch together, hopefully it is pretty straightforward. Previous questions don't use a subclass and in this example there could be dozens of custom pins on the map and each pin passes specific variables to a new ViewController Three Goals: Add image to custom annotation (see code below) I have a subclass named Capital , I would like to add the image in #1 and then create additional variables to hold values that will be passed to a

MKPinAnnotationView custom Image is replaced by pin with animating drop

淺唱寂寞╮ 提交于 2019-12-17 16:46:17
问题 I'm displaying user avatar images on a MapView. The avatars appear to be working if they are rendered without animation, however I'd like to animate their drop. If I set pinView.animatesDrop to true, then I lose the avatar and it is replaced by the pin. How can I animate the drop of my avatar without using the pin? Here is my viewForAnnotation method I'm using: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:

drawing routes on MKMapView [duplicate]

泪湿孤枕 提交于 2019-12-17 16:26:38
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Adding a route to a MKMapView So I am planning to draw multiple routes on the MKMapView. What are the easiest way to do this on iOS? I am not sure if the iPhone can calculate routes if I give them two points (lattitude, longitude). But then if the iPhone were able to calculate a route, then that route might not be the route I want to draw to go from point A to B. Do I need multiple points along the route and

How Can I get Direction on an iPhone iOS 6 App in Xcode from A to B?

落花浮王杯 提交于 2019-12-17 16:26:33
问题 I want to update an app from iOS < 6 that uses Google Maps. My app has a lot of pins on a map, and, when a user taps over one of them, the iPhone call Maps like a shared application to get direction from his current location and the destination with the native Maps App. With iOS 6, the same instructions (posted below) obviously open Safari instead Google Maps. I want to write an if-cycle that checks the iOS installed on the device: if < 6, nothing changed, if iOS > 6 then..... (open new apple