mkannotationview

MapKit (MKMapView): zPosition does not work anymore on iOS11

可紊 提交于 2019-11-27 11:41:19
问题 On iOS11 the zPosition stopped working for the annotationView.layer. Every time the map region changes. No luck with original solution: layer.zPosition = X; No luck with bringViewToFront / SendViewToBack methods Xcode 8.3/9 UPDATE (SOLUTION thanks Elias Aalto): When creating MKAnnotationView: annotationView.layer.zPosition = 50; if (IS_OS_11_OR_LATER) { annotationView.layer.name = @"50"; [annotationView.layer addObserver:MeLikeSingleton forKeyPath:@"zPosition" options:0 context:NULL]; } In

Button action in mkannotation view not working?

核能气质少年 提交于 2019-11-27 08:59:52
Hello i have stuck in one situation on map where i have managed to show custom annotation. When the annotation is tapped i have to show a view with some information and one button. when user taps on the button then one alert should display. code is as follows - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { if (![view.annotation isKindOfClass:[MKUserLocation class]]) { POCustomAnnotation *annotation = (POCustomAnnotation *)[view annotation]; UIView *bgview=[[UIView alloc]initWithFrame:CGRectMake(-30, -150,130, 150)]; bgview.backgroundColor=[UIColor

After JSON parsing -viewForAnnotation shows only ONE single annotation on MKMapView

痞子三分冷 提交于 2019-11-27 08:39:18
问题 I need to show on my MkMapView about 10 locations (and respective annotations) and after pressing a button I need to add new different annotations according to different JSON parsing results (for example a locationIDValue < 100 means a red pin, otherwise green). This is the simplified code: - (void)viewDidLoad { [super viewDidLoad]; map.showsUserLocation = true; map.mapType = MKMapTypeStandard; arrayID = [[NSMutableArray alloc] initWithObjects: @"id1", @"id2", @"id3", @"id4", @"id5", @"id6",

change UIImage from MKAnnotation in the MKMapView

删除回忆录丶 提交于 2019-11-27 08:33:40
问题 I have a mapView with only on MKAnnotation, that has a costume image. When the user changes the mapType, I need to change the image of that annotation. The way I did that was to remove the annotation from the map, and insert another with the correct image, bu i don't think is the best way. It takes about 1 ou 2 seconds to show the new image. How can I do it without remove the annotation and drop another? Thanks, RL 回答1: You can use the viewForAnnotation: instance method of the map view (not

Animate removal of annotations

时光怂恿深爱的人放手 提交于 2019-11-27 05:45:26
问题 I have a map and a set of annotations, each with a 'parent' property. Currently when I add annotations I implement the didAddAnnotationViews method to animate those annotations so they appear to come from their parent's coordinate. Is there a way of doing this during the removal of annotations? When I remove an annotation from the map I want it to animate in to its parent coordinate, and as far as I know there is no equivalent for didAddAnnotationViews for when an annotation is removed. 回答1:

MKMapView moving Annotations Automatically - animate them?

我只是一个虾纸丫 提交于 2019-11-27 05:44:18
问题 I have a data set of annotations that can update very quickly. At the moment I remove all annotations before replotting them back onto the map. NSArray *existingpoints = [mapView.annotations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"!(self isKindOfClass: %@)", [MKUserLocation class]]]; [mapView removeAnnotations:existingpoints]; I calculate where they are anyway within the custom object so would like to be able to call this and "move" the annotation without removing and

Stuck on using MKPinAnnotationView() within Swift and MapKit

拟墨画扇 提交于 2019-11-27 04:33:42
问题 I have a working loop to setup annotations for the title and subtitle elements for some working data points. What I want to do within that same loop structure is to set the pin color to Purple instead of the default. What I can't figure out is what I need to do to tap into my theMapView to set the pin accordingly. My working loop and some attempts at something... .... for var index = 0; index < MySupplierData.count; ++index { // Establish an Annotation myAnnotation = MKPointAnnotation(); ...

Swift - Add MKAnnotationView To MKMapView

独自空忆成欢 提交于 2019-11-27 03:58:37
I'm trying to add MKAnnotationView to MKMapView but I can't do it… Can anyone help me? Here is my code: override func viewDidLoad() { super.viewDidLoad() locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.startUpdatingLocation() var latitude:CLLocationDegrees = locationManager.location.coordinate.latitude var longitude:CLLocationDegrees = locationManager.location.coordinate.longitude var homeLati: CLLocationDegrees = 40.01540192 var homeLong: CLLocationDegrees = 20.87901079 var latDelta:CLLocationDegrees = 0.01 var longDelta:CLLocationDegrees = 0.01 var theSpan

Draw a circle of 1000m radius around users location in MKMapView

自作多情 提交于 2019-11-27 02:51:16
(Using iOS 5 and Xcode 4.2) I have an MKMapView and want to draw a circle of 1000m radius around the user location. On the surface it would seem that implementing the mapView:viewForAnnotation: map view delegate method, and adding a custom MKAnnotationView for the users location, would be a perfect solution. It would look something like this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { // If it's the user location, return my custom MKAnnotationView. if ([annotation isKindOfClass:[MKUserLocation class]]) { return myCustomAnnotationView; }

MKAnnotationView and tap detection

佐手、 提交于 2019-11-27 02:49:31
问题 I have a MKMapView . I added a UITapGestureRecognizer with a single tap. I now want to add a MKAnnotationView to the map. I can tap the annotation and mapView:mapView didSelectAnnotationView:view fires (which is where I'll add additional logic to display a UIView). The issue is now when I tap the annotation, the MKMapView tap gesture also fires. Can I set it so if I tap the annotation, it only responds? 回答1: There might be a better and cleaner solution but one way to do the trick is