mapkit

Mapkit with multi annotation (callout), mapping the next view

柔情痞子 提交于 2019-12-09 07:18:38
问题 Wanted some help with a problem with mapkit I am facing. Should be a silly problem or I have missed out something while going through the mapkit framework. Here is the senario. I am placing multiple annotation on the map when the user performs some search like pizza. Added button for the right annotation view, on click which opens a next detail view. The problem is how to send some information to the next view, for example I add index to annotations while creating them, now I want to access

Change Pin Color when user tapped

旧城冷巷雨未停 提交于 2019-12-09 06:54:39
问题 I would change the color from red to green of an annotation when the user pin tapped addition to changing its title and subtitle. I am truly lost. I searched how to make a custom annotation pin, ok. I found the implementation of the method when the user touches the pin didSelectAnnotationView and it works when I tap the annotation NSLog(@"Tap") ; , but now I can not change the pin that was touched. Thank you very much everyone for your contributions. Ciao 回答1: To set the pin color, make use

Trying to simulate a route in MapView

偶尔善良 提交于 2019-12-09 04:53:21
问题 I have an array of CLLocation objects I parsed from a file. I'd want to simulate that the user is moving along that route, and I have implemented this: for (CLLocation *loc in simulatedLocs) { [self moveUser:loc]; sleep(1); } This is the method called in the loop: - (void)moveUser:(CLLocation*)newLoc { CLLocationCoordinate2D coords; coords.latitude = newLoc.coordinate.latitude; coords.longitude = newLoc.coordinate.longitude; CustomAnnotation *annotation = [[CustomAnnotation alloc]

MapKit zoom to user current location

我的梦境 提交于 2019-12-09 04:15:26
问题 I am trying to simply show user's location on the map, but I need to when app launches, the map should zoom to current location ,but I don't know why map doesn't zoom at all and it's like this : Here is the code : class MapViewController: UIViewController, CLLocationManagerDelegate, MKMapViewDelegate { @IBOutlet weak var mapView: MKMapView! var locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() mapView.delegate = self mapView.showsUserLocation = true

MKPolyline / MKPolylineRenderer changing color without remove it

那年仲夏 提交于 2019-12-08 23:53:46
问题 I working around with map app, I want to ask how to change the polyline color without remove and add it again, I found this topic https://stackoverflow.com/questions/24226290/mkpolylinerenderer-change-color-without-removing-overlay in stackoverflow but this is not involve with my question, I did not touch the line, so no need to do with -[MKMapViewDelegate mapView:didSelectAnnotationView:] So is it possible to do that? EDIT: What I want to do is change the polyline color smoothly (by shading

How to programmatically change map color from day to night in ios7

和自甴很熟 提交于 2019-12-08 20:39:12
问题 I am working on an app for iOS 7, and am trying to change the map from day to night and night to day mode. I have not found any relevant APIs in iOS 7 documentation to do this. 回答1: This is not a built in feature of MKMapKit so what you are asking is not possible without doing it yourself. If you were going to do it yourself, the best you could do would be to find a map tile source of 'night mode' tiles, and use the MKTileOverlay class (New to iOS 7) to replace the content of the map entirely

How to keep pin and map centered above moving overlay in an MKMapView

大城市里の小女人 提交于 2019-12-08 18:22:53
问题 How can I keep a pin centered on a map whilst I move (via Pan Gesture) another view vertically over the map such that the pin remains above the overlay (not an actual MapKit overlay). See attached screenshots for the first and final states. I've got the CGRect of the space between the overlay and the top of the screen as the user pan's up / down. However, how I use that to move the map and pin whilst zooming into the map as the user pans upward..and zoom back out again when the user pans

MKPolylineView initWithPolyLine: is deprecated in iOS 7

こ雲淡風輕ζ 提交于 2019-12-08 16:37:37
问题 I am getting the following error: initWithPolyline : is deprecated: first deprecated in iOS 7.0 MKPolylineView *lineView = [[MKPolylineView alloc] initWithPolyline:overlay]; What is the replacement method of instead of this ? 回答1: See the documentation for initWithPolyline: . Read the Deprecation Statement which says to use an MKPolylineRenderer object instead. 回答2: You should use (MKOverlayRenderer *) type delegate instead of (MKOverlayView *) type delegate. And return MKPolylineRenderer

Zoom MKMapview to closest two MKAnnotations for current user location

Deadly 提交于 2019-12-08 13:28:56
问题 What is the best way to zoom an MKMapview to closest two or three MKAnnotations for current user location? I have a list of GPS coordinates (328 to be precise) loaded from a plist, every point is an annotation on the map. I'd like to limit the view to the two nearest annotation points around the user's current location. 回答1: Roughly, the steps would be: Find current location, convert to MKMapPoint Iterate your list of annotations, using MKMetersBetweenMapPoints to find distance from current

Use GOOGLE maps in iOS supporting iOS 6 and also iOS 5

痴心易碎 提交于 2019-12-08 12:51:29
I am in a need of having maps support for an app, but the concern is prior to ios 6 the iOS mapKit uses the google maps which is rich in content, but in iOS 6 its using its own maps which is not that rich in content. I have search for the Google API for ios 6, which is great but I need to support prior to ios 6 also. Please help. The new Google Maps SDK for iOS supports back to iOS 5.1, see here: https://developers.google.com/maps/documentation/ios/intro#supported_platforms 来源: https://stackoverflow.com/questions/15127806/use-google-maps-in-ios-supporting-ios-6-and-also-ios-5