mapkit

How do I specify the zoom level when using an MKUserTrackingBarButtonItem?

℡╲_俬逩灬. 提交于 2019-12-04 16:23:58
问题 I am using a MKUserTrackingBarButtonItem button to allow the user to automatically track their location on a map. The problem is that when they tap this button, it is zoomed too far out. I want it to start at a specified zoom level (i.e. span). How can I achieve this? When the user taps the button to change to MKUserTrackingModeFollow , it seems to use the same zoom level that the user last manually changed to (i.e. using gestures on the map). Attempting to specify a different zoom level via

Routing Data for MKMapKit in iOS6

半腔热情 提交于 2019-12-04 15:21:46
I have done routing in iOS apps before, but with iOS6 we are now displaying Apple maps - which causes a problem because we are using Google routing data and if we use Google data, we are supposed to be displaying it on a Google map. I have been searching but as far as I can tell, Apple does not provide any routing data. The closest thing to an answer so far seems to be when Apple says Apps that consume direction information do so by sending an appropriate request to the Maps app, which then handles the task of displaying that information to the user. - which, to me, means that the Maps app

Making map pins spread out from a cluster

↘锁芯ラ 提交于 2019-12-04 14:29:56
I've got two custom annotation classes for my map: one for a single post tied to a location, and one for a cluster of those posts. The cluster stores pointers to all of the posts it contains, as well as a central lat/long location (calculated using the locations of the posts it contains). I have the behaviour that when I click on a cluster annotation it removes the cluster and adds its posts to the map. What I want is to change the pin-drop annotation when expanding the clusters to an animation whereby the new pins move outwards from the centre of the cluster to their new locations. However, I

Search nearby in iOS Maps

我与影子孤独终老i 提交于 2019-12-04 14:16:05
问题 I am trying to build a simple application using MapKit that will automatically search for a specific place when the app launches and drop pin(s) on the map at the locations(s). I am seeing all sorts of ways to load locations (lat/lon, etc), but nothing that lets me search for a specific business name, restaurant name, etc. I am expecting to work with Apple Maps. However, if Google Maps would be a better solve than so be it. Any help would be appreciated. Thanks 回答1: iOS >= 6.1 provides

iOS MapKit Annotation, not showing correct location

拜拜、爱过 提交于 2019-12-04 14:05:21
I using a custom image for my mapkit annotation. But the main problem it seems that I am running into in using a custom image, is that when zoomed out, the annotation is not in the correct point on the map, and ONLY until I zoom in all the way down, will it show the annotation point in the correct place. It seems that when I use a regular pin MKPinAnnotationView , it works normally, as with the pin being in the correct place zoomed in or out, thanks in advance for anyone that can help. The code I have used is as follows: - (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id

Swift - setting rounded corners to annotation view image

房东的猫 提交于 2019-12-04 13:39:37
Here is my previous thread, where I set image to annotation view pins Swift - setting different images from array to annotation pins Right now I encountered a problem with setting rounded corners on annotation view image. cannot show callout with clipsToBounds enabled swift appears that I have to choose between rounded corners or showing callout, I don't really get why these two can't come along. Is there any way to do that? Here is my viewForAnnotation function: func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! { if !(annotation is

Mapkit pin color not changing

不打扰是莪最后的温柔 提交于 2019-12-04 13:29:16
I'm doing the following and always get green pins: pin.pinColor = MKPinAnnotationColorRed; [self.mapView addAnnotation:pin]; [pin release]; pin is of type "NSObject ". All pins come out as green. Should I be doing it differently? Make sure your pin class implements the MKAnnotation protocol and I believe to get a non-standard pin color, you'll have to implement the viewForAnnotation method. - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation

Calculating Distance iOS MapKit Using CLLocation

*爱你&永不变心* 提交于 2019-12-04 12:58:25
I am trying to find the distance in miles using the latitude and longitude. I have the following method: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { if(!newLocation) return; if ((oldLocation.coordinate.latitude != newLocation.coordinate.latitude) && (oldLocation.coordinate.longitude != newLocation.coordinate.longitude)) { CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:oldLocation.coordinate.latitude longitude:oldLocation.coordinate.longitude]; CLLocation *loc2 = [[CLLocation alloc]

How to fit a certain bounds consisting of NE and SW coordinates into the visible map view?

六月ゝ 毕业季﹏ 提交于 2019-12-04 12:26:16
问题 I need to fit a certain bounds within a map. I get the bounds from calling the google geocoder and reading the viewport property which looks like: { northeast = { lat = "30.4212235"; lng = "-97.486942"; }; southwest = { lat = "30.1128403"; lng = "-97.99917959999999"; }; } I then convert these into CLLocationCoordinate2D NSDictionary *viewport = [[[results objectAtIndex:0] objectForKey:@"geometry"] objectForKey:@"viewport"]; NSDictionary *NEDictionary = [viewport objectForKey:@"northeast"];

MKMapItem placemark is unavailable in swift

落花浮王杯 提交于 2019-12-04 11:15:42
I am currently trying to make a searchbar that autopopulates with locations as the user types. I am using a MKLocalSearch to get a MKLocalSearchResponse and it appears to return values I can use. However to get the name, address or coordinates out of the search needs access to the MKPlacemark property in the search response. When I access the placemark I get the error: 'placemark' is unavailable: APIs deprecated as of iOS7 and earlier are unavailable in Swift var request = MKLocalSearchRequest() request.naturalLanguageQuery = searchText //PUT HERE: check if network is on? let localSearch: