mapkit

Drawing a route in MapKit in iOS

谁说胖子不能爱 提交于 2019-11-26 12:02:50
I want to draw a route between two locations on the map. Something like a tour guide. When the tourist clicks another location, I want to be able to draw a route; as well as, inform about the distance from the current location. I am aware of sites on the Internet which tell how to draw polylines on map. But, most of the examples had a preloaded .csv file with various coordinates. Is there an alternative way to get the coordinates from Google or any other provider, as the location is selected dynamically. If NO, how do I get the information for intermediate coordinates? Does iOS 6 provide any

Snapshot of MKMapView in iOS7

你离开我真会死。 提交于 2019-11-26 11:53:35
问题 I am trying to create a snapshot of a MKMapView in iOS7 application the same way it\'s recommended everywhere for previous iOS versions: - (UIImage*) renderMapViewToImage { UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0); [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } However, the image returned is a black rectangle with a blue current location dot on

Map view annotations with different pin colors

点点圈 提交于 2019-11-26 11:36:07
问题 I have an array with over 200 objects and I am trying to perform a loop through each of them. Each object will have a yes/no field and I want to display a different coloured marker dependent on that yes / no value. From what I can see is happening my loop is going through each object first and then all the annotation is added at the end for each object . Since I perform a check within my loop through the array on the yes no value when all the annotation is added to my map, it will use the yes

How to define the order of overlapping MKAnnotationViews?

别来无恙 提交于 2019-11-26 11:08:55
问题 I have several MKAnnotations (and their corresponding views) in my map, and it sometimes gets really crowded. Now, the annotations in my app come in two flavors: some are bound to stay where they are, while others will move as time goes on. I\'d prefer to have the more stable ones visually in the background and the moving ones to always pass in front of them. One would think, perhaps, that the annotations most recently added to the map would end up to the front (or alternatively at the very

How do I animate MKAnnotationView drop?

随声附和 提交于 2019-11-26 10:31:41
问题 I have a custom MKAnnotationView where I set my image myself in viewForAnnotation. How do I animate it\'s drop like I can with MKPinAnnotationView? My code is - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *AnnotationViewID = @\"annotationViewID\"; MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID]; if (annotationView == nil) { annotationView = [[

iOS - How to limit the MapView to a specific region?

China☆狼群 提交于 2019-11-26 10:25:40
问题 I have the following problem: I have a \"drawn map\" (image) which I add to the MapView as an Overlay. No Problem with that.. but I need to limit the MapView to the region of the Overlay, so a user isn\'t able to scroll/zoom outside of this region.. but it should be possible to scroll/zoom inside the \"bounds\" of the overlay - means I cannot just disable zoom/scrolling for the MapView. Are there any ideas/solution on this topic? The reason for using the MapView/-Kit is that I need to add

MKMapView MKPointAnnotation tap event

耗尽温柔 提交于 2019-11-26 10:23:28
问题 I have a list of annotations (MKPointAnnotation). I have a UIViewController which is for the whole view, MKMapView implementing Controller, which I thought is useful for detecting the users interaction with the map, my own MKPointAnnotation implementing (subclass) Controller which tells how to show the annotation. However I\'m struck at the detection of the tap event by the user. Googling told me that I have to do something by implementing the following function. - (void)mapView:(MKMapView *

Gradient Polyline with MapKit ios

与世无争的帅哥 提交于 2019-11-26 09:27:32
问题 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

MKAnnotationView - Lock custom annotation view to pin on location updates

大城市里の小女人 提交于 2019-11-26 08:56:19
问题 Update #5 I guess it\'s bounty time. 100+ views and no one\'s taken a stab, even with the code sample I\'ve posted. How about some reputation points! Update #4 This is a pretty complicated question, so I created a new tab based project which just includes the parts of my app I\'m having trouble with here. You can download it from: http://www.servinitup.net/CustomCalloutAnnotation.zip Feel free to open it up (need to add your own bundle identifier to run it on your phone) and play around with

Getting the bounds of an MKMapView

廉价感情. 提交于 2019-11-26 08:47:44
问题 In order to setup a query to an external server I want to get the bounds of the current Map View in an iPhone app I\'m building. UIView should respond to bounds but it seems MKMapView doesn\'t. After setting a region and zooming in the map I try to get the bounds. I\'m stuck on the first step which is to try to get the CGPoints that represent the SE and NW corners of the map. After that I was going to use: - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *