mapkit

Z-ordering of MKAnnotationViews

半世苍凉 提交于 2019-11-27 20:44:13
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 even respect the draw order. What's up with that? I've tried solving #1 using something similar to the

MapKit iOS 9 detailCalloutAccessoryView usage

天大地大妈咪最大 提交于 2019-11-27 19:49:11
After watching WWDC video 206 I assumed this would be a trivial task of adding the detail callout view to a mapView annotation view. So, I assume Im doing something wrong. With my pin view set up func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { let view:MKAnnotationView! if let dequed = routeMapView.dequeueReusableAnnotationViewWithIdentifier("pin") { view = dequed } else { view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin") } let x = UIView(frame: CGRectMake(0, 0, 200, 200)) x.backgroundColor = UIColor.redColor() //

How to display an image on a MKOverlayView?

女生的网名这么多〃 提交于 2019-11-27 18:51:33
UPDATE: Images who are projected on the MKMapView using a MKOverlayView use the Mercator projection , while the image that I use as input data uses a WGS84 projection. Is there a way to convert the input image, to the right projection WGS84 -> Mercator, without tiling the image up and can it done on the fly? Normally you could convert a image to right projection using the program gdal2tiles . The input data however changes every fifteen minutes, so the image has to be converted every fifteen minutes. So the conversion has to be done on the fly. I also want the tiling to be done by Mapkit and

Detecting touches on MKOverlay in iOS7 (MKOverlayRenderer)

社会主义新天地 提交于 2019-11-27 18:34:05
I have an MKMapView with possibly hundreds of polygons drawn. Using MKPolygon and MKPolygonRenderer as one is suppose to on iOS7. What I need is a way of acting upon the user touching one of the polygons. They represent an area on the map with a certain population density for example. On iOS6 the MKOverlays were drawn as MKOverlayViews so touch detection was more straightforward. Now using renderers I don't really see how this is suppose to be done. I'm not sure this will help or is even relevant but as a reference I'll post some code: This adds all the MKOverlays to the MKMapView using

How to use custom icons with mapKit framework?

本小妞迷上赌 提交于 2019-11-27 18:24:56
问题 I am using the MapKit framework to load google maps on my application and I place on map 4 "simulated" places like this: - (void)viewDidLoad { [super viewDidLoad]; mapView.delegate = self; mapView.showsUserLocation = YES; MKUserLocation *userLocation = mapView.userLocation; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance (userLocation.location.coordinate,500,500); [mapView setRegion:region animated:NO]; //Simulated annotations on the map CLLocationCoordinate2D poi1Coord ,

Calculating tiles to display in a MapRect when “over-zoomed” beyond the overlay tile set

微笑、不失礼 提交于 2019-11-27 18:13:16
I am working on an app that uses MKOverlay views to layer my own custom maps on top of the Google base map. I have been using Apple's excellent TileMap sample code (from WWDC 2010) as a guide. My problem - when "overzoomed" to a level of detail deeper than my generated tile set, the code displays nothing because there are no tiles available at the calculated Z level. The behavior I want - when "overzoomed" the app should just keep magnifying the deepest level of tiles. It is a good user experience for the overlay to become blurrier - it is a very bad experience to have the overlay vanish. Here

Zoom in a MKMapView programmatically

*爱你&永不变心* 提交于 2019-11-27 17:37:44
I'm using a MKMapView inside an iPhone app. When I click a button the zoom level must increase. This is my first approach: MKCoordinateRegion zoomIn = mapView.region; zoomIn.span.latitudeDelta *= 0.5; [mapView setRegion:zoomIn animated:YES]; However, this code had no effect, since I didn't update the longitudeDelta value. So I added this line: zoomIn.span.longitudeDelta *= 0.5; Now it works, but only sometimes. The latitudeDelta and longitudeDelta don't change in the same way, I mean, their values are not proportional. Any idea how to solve this? I have no idea if this is the right way to do

Convert coordinates to City name?

旧巷老猫 提交于 2019-11-27 17:23:34
How to get an address from coordinates using MapKit? I have this code when long press on the map it gets the coordinates: func didLongPressMap(sender: UILongPressGestureRecognizer) { if sender.state == UIGestureRecognizerState.Began { let touchPoint = sender.locationInView(self.mapView) let touchCoordinate = self.mapView.convertPoint(touchPoint, toCoordinateFromView: self.mapView) var annotation = MKPointAnnotation() annotation.coordinate = touchCoordinate annotation.title = "Your position" self.mapView.addAnnotation(annotation) //drops the pin println("lat: \(touchCoordinate.latitude)") var

How to find location using MapKit in Xcode?

妖精的绣舞 提交于 2019-11-27 15:21:10
Hey everyone, I was wondering how to use the MapKit in Xcode? A lot of people told me not to use the Google Map website and integrate it with the UIWebView because it seems a little strange when people are viewing the location in a web view, so I was wondering if anyone can help me step-by-step how to setup MapKit, how pinpoint an address location on the map and find the routes between user's current location and the pinpointed address location? Sorry if I'm not a really good programmer with MapKit and hope someone can help me, thanks Michael youruimapview.showsUserLocation=TRUE; 来源: https:/

Make a UIImage from a MKMapView

早过忘川 提交于 2019-11-27 15:06:58
问题 I want to create a UIImage from a MKMapView . My map is correctly displayed in the view, however the UIImage produced is just a gray image. Here's the relevant snippet. UIGraphicsBeginImageContext(mapView.bounds.size); [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; mapImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Anyone know how to make a UIImage using MapKit? 回答1: I am using the same code that is tested with ios sdk 4.1 and works fine. So,