Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 标注附件未出现_Ios_Mkmapview_Mkannotationview_Mkpinannotationview - Fatal编程技术网

Ios 标注附件未出现

Ios 标注附件未出现,ios,mkmapview,mkannotationview,mkpinannotationview,Ios,Mkmapview,Mkannotationview,Mkpinannotationview,我正在尝试将常规详图索引附件添加到注释区域,但由于某些原因,它没有显示出来。 代码如下: - (void) setupMap:(PFObject*) venue { ... OTNVenueAnnotation *annotation = [[OTNVenueAnnotation alloc] init]; annotation.coordinate = CLLocationCoordinate2DMake(location.latitude, location.longitude); an

我正在尝试将常规详图索引附件添加到注释区域,但由于某些原因,它没有显示出来。 代码如下:

- (void) setupMap:(PFObject*) venue {

...

OTNVenueAnnotation *annotation = [[OTNVenueAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(location.latitude, location.longitude);
annotation.title = [[venue objectForKey:@"name"] uppercaseString];
annotation.venue = venue;


UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

MKPinAnnotationView *customPinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"identifier"];
customPinView.leftCalloutAccessoryView = rightButton;
[self.mapView addAnnotation: annotation];

}

尝试在地图视图视图的委托方法中为注释设置leftCalloutAccessoryView,例如:

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation 
{
    MKPinAnnotationView *annView= (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"identifier"];
    UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    annView.leftCalloutAccessoryView = rightButton;
    annView.canShowCallout = YES;
    return annView;
}
-(MKAnnotationView*)地图视图:(MKMapView*)地图视图注释:(id)注释
{
MKPinAnnotationView*annView=(MKPinAnnotationView*)[self.mapView dequeuereusableannotationview with identifier:@“identifier”];
UIButton*rightButton=[UIButton Button类型:UIButtonTypedTailButton];
annView.leftCalloutAccessoryView=rightButton;
annView.canShowCallout=是;
返回视图;
}