iOS 8 MKAnnotationView rightCalloutAccessoryView misaligned

前端 未结 7 1693
生来不讨喜
生来不讨喜 2020-12-24 01:51

I\'m still pretty new to the iOS stuff in general and found a problem while testing our App for iOS 8 compatibility. In iOS 7 everything worked fine but on iOS 8 the rightCa

7条回答
  •  失恋的感觉
    2020-12-24 02:08

    I got mine to work by setting my map view's delegate prior to adding the annotation and did not have to change anything in the del.

    Going from the following:

        self.mapView = [[MKMapView alloc] init];
        NGAAnnotation *annotation = [[NGAAnnotation alloc] init];
        annotation.coordinate = coordinates;
        annotation.title = self.project.name;
    
        [self.mapView addAnnotation:annotation];
        self.mapView.delegate = self;
    

    To:

        self.mapView = [[MKMapView alloc] init];
        NGAAnnotation *annotation = [[NGAAnnotation alloc] init];
        annotation.coordinate = coordinates;
        annotation.title = self.project.name;
    
        self.mapView.delegate = self;
        [self.mapView addAnnotation:annotation];
    

    Fixed it for me. I noticed that the delegate method gets called when the annotation is added so if the delegate is not set prior to you adding the annotation it will not get called.

提交回复
热议问题