mapkit

Is it possible to force MapKit to show all annotations without clustering?

孤者浪人 提交于 2019-12-01 05:47:37
问题 I have two classes that both conform to MKAnnotation , and I was wondering, is there a way to force MapKit to not cluster the annotation when a user zooms out and display all annotations? 回答1: Set MKAnnotation's clusteringIdentifier to nil. e.g. class BikeView: MKMarkerAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has

How to draw UIBezierPath identical to MKPolyline in a UIView

给你一囗甜甜゛ 提交于 2019-12-01 05:47:30
问题 Currently I am tracking my location on an MKMapView. My objective is to draw a bezier path identical to an MKPolyline created from tracked locations. What I have attempted is: Store all location coordinates in a CLLocation array. Iterate over that array and store the lat/lng coordinates in a CLLocationCoordinate2D array. Then ensure the polyline is in the view of the screen to then convert all the location coordinates in CGPoints. Current attempt: @IBOutlet weak var bezierPathView: UIView!

iOS overlay (MKPolygon) data for all U.S. states?

蹲街弑〆低调 提交于 2019-12-01 05:15:34
In the Displaying Overlays on a Map section of the iOS Developer Library Location Awareness Programming Guide, there is an example that "shows a filled and stroked overlay covering the state of Colorado." // Define an overlay that covers Colorado. CLLocationCoordinate2D points[4]; points[0] = CLLocationCoordinate2DMake(41.000512, -109.050116); points[1] = CLLocationCoordinate2DMake(41.002371, -102.052066); points[2] = CLLocationCoordinate2DMake(36.993076, -102.041981); points[3] = CLLocationCoordinate2DMake(36.99892, -109.045267); MKPolygon* poly = [MKPolygon polygonWithCoordinates:points

Xcode Error: Outlets cannot be connected to repeating content

蓝咒 提交于 2019-12-01 04:26:01
After doing some searching and editing, I can't seem to find a solution to fixing this error. I'm trying to link my location search results with a table to display the search results in a list-form. I have my map with the details button linked with a UIViewController called 'FirstViewController.' My results table is linked with a UITableViewController called 'ResultsTableViewController.' My prototype cells are linked with a UITableViewCell called 'ResultsTableCell' which is also where my outlets are located. Here are the 2 separate errors: Illegal Configuration: The nameLabel outlet from the

How to check if Apple Maps is installed

可紊 提交于 2019-12-01 02:32:54
Anyone aware how to check whether Apple Maps is installed or not? I could not find anything in the docs. With iOS10 users can delete the Apple Maps application. While for Google Maps we can use UIApplication.shared.canOpenURL() to check if it's installed. I am not aware of such a thing exists to check for Apple Maps. Of course one can check if opening a MKMapItem with mapItem.openInMaps() fails - but that does not help for checking in advance. The simple answer is this is not currently possible. The reason is that Apple Maps application is not deleted, only application icon is removed from

Black and white overlay for an MKMapView

爷,独闯天下 提交于 2019-12-01 01:58:40
问题 I have an MKMapView and am adding an overlay (MKOverlay) to it. I would like the overlay to make the map view underneath to appear black & white (i.e. monochrome). Is there any way of doing this? (I guess I could make the overlay translucent black/gray, but that's not the exact effect I would like.) System details: developing an iOS 5 app in Xcode 4.2. 回答1: The most proper route, which sadly isn't yet available on iOS would be: Your MKOverlay is at some point being used to create an

Map annotation display all the same image/pins for all points

不打扰是莪最后的温柔 提交于 2019-12-01 01:32:32
I have a conditional statement to add map annotation icons/pins in the method below. The problem I'm having is that the map is being populated with all the same icon. It should detect the cat id and display the icons depending on which cat id is detected. I'm not sure what the problem is because this did work in iOS 6 and now in iOS 7 the map only displays all the same annotation icon images. - (MKAnnotationView *) mapView:(MKMapView *)mapingView viewForAnnotation:(id <MKAnnotation>) annotation { annView = nil; if(annotation != mapingView.userLocation) { static NSString *defaultPinID = @"";

Is MKMapView leaky

☆樱花仙子☆ 提交于 2019-12-01 01:19:18
As well as my question "Removing MKMapView Annotations causes leaks." I have discovered that if you create a view based project, add a UISearchBar and MKMapView into the view's NIB, wire up the delegates (I'm not creating any methods as we don't actually need to do anything to trigger the leaks), link in the MapKit and fire up the project, then simply clicking in the UISearchBar causes a 1k+ leak. This doesn't happen unless you have both UISearchBar and MKMapView in a view. I have the same issues when creating the views from code. I thought a NIB might behave differently, but it doesn't. Is

How to display user location in mapkit?

南楼画角 提交于 2019-12-01 00:19:06
I'd like to display the blue pulsing dot for a user's location. I'm doing this: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ //some other stuff here [self.mapView setShowsUserLocation:YES]; } But I eventually get -[MKUserLocation establishment]: unrecognized selector sent to instance 0x125e90 Should I be doing this some other way? -- EDIT -- I'm also doing this, which is where I eventually get the above exception: - (MKAnnotationView *) mapView:(MKMapView *)_mapView viewForAnnotation:(AddressNote *)

How to rotate custom userLocationAnnotationView image using MapKit in swift?

好久不见. 提交于 2019-11-30 23:10:30
I'm trying to find a way to show the direction of the user on the map using MapKit. The native MapKit way to do that always rotate the entire map. Since user position is also an MKAnnotationView, I decided to create a specific class to override it and use a specific image (with an arrow). class UserLocationAnnotationView: MKAnnotationView { override init(frame: CGRect) { super.init(frame: frame) } override init(annotation: MKAnnotation!, reuseIdentifier: String!) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) var frame = self.frame frame.size = CGSizeMake(130, 130) self