mapkit

ios sdk MKMapView overlapping pins?

こ雲淡風輕ζ 提交于 2019-12-04 04:52:14
问题 I have map view and many pins on it. When the map view is zoomed out, I group overlapping pins into 1 (and show in label total count of pins in it). But what to do, if map view is max zoomed in, and pins are still overlapped? How can I shift them while they do not overlap each other ? Something like this: Or is there another solution? 回答1: In a slightly different solution to the same problem, the demo in the WWDC 2011 #111 - Visualizing Information Geographically with MapKit video (the demo

Convert MKAnnotation Coordinates to View Coordinates

ⅰ亾dé卋堺 提交于 2019-12-04 04:35:34
问题 I am displaying a custom UIView when the user clicks on the pin (Like the Zillow app). Now the problem is that I need to place the view right above the actual pin. The MKAnnotationView coordinates system is related to the map. How can I get the coordinates with respect to the iPhone screen and then place my view on that coordinate. - (void)mapView:(MKMapView *)mv didSelectAnnotationView:(MKAnnotationView *)view { // get view from storyboard ZillowSearchResultAnnotation *annotation =

Change the image's origin of map annotation view?

房东的猫 提交于 2019-12-04 04:28:55
The regular annotation pin's origin is in the middle of the bottom so, the pin always point to the same place. But when I add my custom image, its origin is the center of the image, so every zoom in or out, the bottom of my image point to a different place. Here my pin is supposed to point to the center of paris BUT but when I zoom in, the bottom of my pin isn't pointing to the center of Paris. I'm trying with the CGRect.origin but didn't get anything useful. Here is my code: - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation {

Unable to draw MKPolylineView crossing longitude +/-180

爱⌒轻易说出口 提交于 2019-12-04 04:15:41
问题 I'm having a problem drawing an MKPolylineView on an MKMapView. The line represents a trip around the world, which begins and ends near New York, always traveling east. One leg of the trip, from Japan to San Francisco, crosses the Pacific ocean, and therefore longitude +/-180. The MKPolylineView does connect those two points, but it travels in the wrong direction. That is, the line travels west from Japan back to San Francisco, instead of east across the Pacific. I don't see any option that

How to reposition compass of MKMapView?

怎甘沉沦 提交于 2019-12-04 04:11:33
问题 I want to move the MKMapView compass. I wanted to get a reference for it by something like this: let compassView = mapView.subviews.filter {$0 is NSClassFromString("MKCompassView")} However the compiler complains " Use of undeclared type 'NSClassFromString' ". How can I fix this code? 回答1: iOS 11 you should use MKCompassButton , doc explaining the new stuff: WWDC 2017 new MapKit presentation. let compassButton = MKCompassButton(mapView:mapView) compassButton.frame.origin = CGPoint(x: 20, y:

MKMapView center and zoom in

你。 提交于 2019-12-04 03:33:06
I am using MKMapView on a project and would like to center the map on a coordinate and zoom in. Just like Google maps has: GMSCameraPosition.camera(withLatitude: -33.8683, longitude: 151.2086, zoom: 6) Is there any Mapkit method for this? You'd create a MKCoordinateRegion object and set that as the region on your MKMapView object. MKCoordinateRegion mapRegion; CLLocationCoordinate2D coordinate; coordinate.latitude = 0; coordinate.longitude = 0; mapRegion.center = coordinate; mapRegion.span.latitudeDelta = 0.2; mapRegion.span.longitudeDelta = 0.2; [mapView setRegion:mapRegion animated: YES];

How to get lat and long coordinates from address string

♀尐吖头ヾ 提交于 2019-12-04 03:27:36
I have a MKMapView that has a UISearchBar on the top, and I want the user to be able to type a address, and to find that address and drop a pin on it. What I don't know is how to turn the address string into longitude and latitude, so I can make a CLLocation object. Does anyone know how I can do this? arjavlad You may find your answer in this question. iOS - MKMapView place annotation by using address instead of lat / long By User Romes. NSString *location = @"some address, state, and zip"; CLGeocoder *geocoder = [[CLGeocoder alloc] init]; [geocoder geocodeAddressString:location

MKMapSnapshotter uses incredible amounts of CPU & RAM

一笑奈何 提交于 2019-12-04 02:57:50
MKMapSnapshotter seems to use up to 2GB of RAM when in the simulator, and triggers memory warnings and hangs my app for a very long time on the device. I'm not sure what part of my settings is causing this. This huge usage occurs when retrieving multiple image simultaneously, but even retrieving multiple images one after the other seems to use frankly huge amounts of RAM, 600MB at peak, and fully occupies the CPU, using up to 190%. I've tried removing all other logic, not even saving the images after they're requested, and the huge RAM & CPU usage still occurs. This cannot be intended. There

Will MKMapView automatically use Google Maps in iOS6, as google maps is restored in iOS6?

三世轮回 提交于 2019-12-04 02:11:29
问题 As apple has restored google maps in iOS6, if I'm using MKMapView in my iPhone app, will it automatically use google maps? 回答1: If you want to use Google Maps in your app, you should use Google Maps SDK for iOS https://developers.google.com/maps/documentation/ios 回答2: No, it's an Apple API so will use Apple's default maps. Apple has not restored Google Maps. Google has released an iPhone app. 回答3: Maybe the source of the confusion (at least for me), is the following text snippet from Apple's

Check user location age in Mapkit - GPS accuracy for MapKit User Location significantly better than from CLLocationManager?

社会主义新天地 提交于 2019-12-04 02:06:02
问题 Indoors on an iPhone 4. WiFi disabled Running the LocateMe SDK sample or my own code for 30-60 seconds produces horizontal accuracy of 2294 meters. Pretty inaccurate but reasonable for cell tower triangulation. Looking at other apps that do reverse geocoding or location stuff like Foursquare shows a similar lack of accuracy. However, if I switch over to another view in my app that uses Mapkit and check/display the user location it is spot on. I mean to the house level accurate on the map