Es funktioniert gut auf iOS 7, aber UIImageViews Position verschiebt sich auf iO8 wie Bilder unten. Auch die rightCalloutAccessoryView-Position verschiebt die obere rechte Ecke.UIImageView als Callouts linksCalloutAccessoryView verschiebt automatisch die obere linke Ecke
Kann jemand helfen?
Prost.
Ios 7
Ios 8
- (void) mapView: (MKMapView *) mapView didSelectAnnotationView: (MKAnnotationView *) Ansicht {
if(![view.annotation isKindOfClass:[MKUserLocation class]]) {
UBAnnotation *selectedAnnotation = view.annotation;
NSURL * imageUrlAtIndex = [NSURL URLWithString:[[self.objects objectAtIndex:selectedAnnotation.idx] ad_thumbImageUrl]];
UIImageView * leftCalloutView = [[UIImageView alloc] initWithFrame:CGRectMake(2, 2, 40, 40)];
[leftCalloutView setImageWithURL:imageUrlAtIndex];
leftCalloutView.layer.masksToBounds = YES;
leftCalloutView.layer.cornerRadius = 6;
view.leftCalloutAccessoryView = leftCalloutView;
}
}
- (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id) Anmerkung {
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return nil;
} else {
annView.image = [UIImage imageNamed:@"pin"];
annView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annView.rightCalloutAccessoryView.tintColor = [UBColor ubGreenColor];
annView.animatesDrop= NO;
annView.canShowCallout = YES;
}
return annView;
}
Es klingt wie Fehler in iOS 8, wenn es so zu beheben ist. – Ramis
Die 'leftCalloutAccessoryView' ist automatisch so eingerichtet, dass der linke Rand und der obere Rand gleich sind. Und es ist vertikal zentriert mit einer Priorität von 250. Die Kompressionswiderstandspriorität des Etiketts ist jedoch '750'. Wenn also die Beschriftung abgeschnitten werden muss, wird die linke Callout-Ansicht nach links verschoben, wodurch sie ebenfalls nach oben verschoben wird. –