mkmapview

Eliminate Pin Overlap in the MKMapView

时间秒杀一切 提交于 2019-12-08 03:44:06
问题 I am working with MKMapView Based application. I need a clarification whether it is possible to eliminate the pin OverLap in the MKMapView? Because at some places there are large number of pins displaying. It is difficult to me to identify the pins. 回答1: If you have an Apple Developer Account, I would strongly recommend getting the Session 111 video from the 2011 WWDC Conference Sessions, entitled "Visualizing Information Geographically with MapKit". One of the segments specifically covers

Setting image for MKAnnotation

点点圈 提交于 2019-12-08 02:56:23
问题 I added MKAnnotation in my mapview using the following code. Flag *flag = [[Flag alloc] init]; flag.title = @"Golf Course"; flag.subtitle = @"Green"; flag.coordinate =CLLocationCoordinate2DMake(28.457394,77.108667); [mapView addAnnotation:flag]; and am setting image like -(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation { if(([annotation isKindOfClass:[Flag class]])) { MKPinAnnotationView *pinView = nil; if(annotation != mapView.userLocation) {

Swift: Draw a semi-sphere in MKMapView

强颜欢笑 提交于 2019-12-08 02:45:33
问题 I am trying to draw a semi-sphere on MKMapView knowing the center coordinates, start and end angles, and radius in nautical miles. Using this thread(How to draw UIBezierPath overlay on MKMapView?), I have subclassed MKOverlayPathRenderer to draw an arc: import UIKit import MapKit class IGAAcarsDrawArc: MKOverlayPathRenderer { let PI = 3.14159265 let radius : CGFloat = 10.0 var startAngle: CGFloat = 0 var endAngle: CGFloat = 3.14159 var latitude = 25.96728611 var longitude = -80

Draw MKPointAnnotation with title in MKSnapshot image

空扰寡人 提交于 2019-12-08 01:04:31
问题 I'm trying to draw an annotation exactly as in a 'live' MapView, but then in a MKSnapshot. Why an MKSnapshot > because I want to have non-interactive MapViews in a UITableView and using images is more efficient. I can get a pin to be drawn (though not a point as in iOS 11, the pin looks old) using MKPinAnnotationView, but also then there is no title of the annotation on the image. Using almost exactly this code: Snapshot of MKMapView in iOS7. 回答1: You can use the following steps: with

MKAnnotationView Only Rotate the Image property

為{幸葍}努か 提交于 2019-12-08 00:51:52
问题 I have an MKAnnotationView where I want to rotate the image property only. If I use the following... self.image= image; [self setTransform:CGAffineTransformMakeRotation(DEG2RAD([item.heading floatValue]))]; It rotates the whole annotationView and the subsequent callouts which I do not want. Is there a way to just rotate the image property? 回答1: The simplest way is probably to put the image in a UIImageView, add that as a subview to the MKAnnotationView, and affine that. If you are targeting

Loading MKMapView asynchronously?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 22:42:54
问题 When I first bring up an MKMapView my app seems to pause while it loads. I am assuming this is because it doesn't load asynchronously. Is there any way I can get around this. While it loads you can't switch tabs or do anything. Thanks EDIT: here is my viewDidLoad method: CGRect bounds = self.view.bounds; mapView = [[MKMapView alloc] initWithFrame:bounds]; mapView.mapType=MKMapTypeStandard; mapView.showsUserLocation = YES; mapView.delegate = self; [self.view insertSubview:mapView atIndex:0];

mapView not zooming on second try using didUpdateUserLocation

纵然是瞬间 提交于 2019-12-07 21:53:08
问题 i am loading a mapviewcontroller when the view map button is pressed from my mainviewcontroller: - (IBAction)mapButton:(id)sender { MapKitDisplayViewController *mapKitDisplayView = [[MapKitDisplayViewController alloc] init]; [self presentModalViewController:mapKitDisplayView animated:YES]; [mapKitDisplayView release]; mapKitDisplayView = nil; } On startup of this map view this method is called, which correctly zooms to the users location: - (void)mapView:(MKMapView *)myMapView

MKMapView regionDidChangeAnimated called by user action or program

雨燕双飞 提交于 2019-12-07 21:13:52
问题 I have a MKMapView with some annotations in it. Now, every time when the region changes I load new annotations. That works fine, but if some annotation is near border of the map view and you tap on it, the annotation info window pops out and the mkmapview region moves a little (so that it can show the window nicely), but the problem is that also the regionDidChangeAnimated is called and it reloads all my annotations and of course hides the info window. I know you can just tap the annotation

Mapkit is using too much CPU in IOS 13

我的未来我决定 提交于 2019-12-07 19:47:49
问题 Recently my iOS app starting crashing frequently after some users updated to iOS 13.x (it doesn't exhibit the problem in iOS 12.x) I am using Mapkit to render some MKPolygons and MKPolylines. The MKPolylines get removed and re-added to the MKMapView around 10 times per second (that's because my GPS is giving me new lat/longs at 10Hz). I profiled my app in iOS 12.x and it is using around 15% to 30% of CPU resources (iPad Mini 4). I did the same profiling in iOS 13.1.2 and 13.1.3, and the CPU

How to delete the last annotation on a mapView

假装没事ソ 提交于 2019-12-07 12:59:31
I have added a button on my .xib file with which I want to delete the last annotation that has been added. So on the Touch-Down action I have implemented this: -(IBAction)DeleteAnnotation:(id)sender { [mapview removeAnnotation:[mapview.annotations lastObject]]; } and I have even tried it this way: -(IBAction)DeleteAnnotation:(id)sender { [self.mapview removeAnnotation:self.mapview.annotations.lastObject]]; } where mapview is my MKMapView Outlet. The problem I encounter with both ways is that I have to press this specific button quite a few times before an annotation is removed. Furthermore,