我正在尝试将标注附件添加到一些现有代码中。下面是我的注释主代码:
OTNVenueAnnotation *annotation = [[OTNVenueAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(location.latitude, location.longitude);
annotation.title = [[venue objectForKey:@"name"] uppercaseString];
annotation.venue = venue;
MKPinAnnotationView* customPinView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation];
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
customPinView.rightCalloutAccessoryView = rightButton;
[self.mapView addAnnotation: annotation];生成错误是:'MKPinAnnotationView‘没有可见的@接口声明了选择器'initWithAnnotation:’
发布于 2013-06-21 05:17:03
方法名为initWithAnnotation:reuseIdentifier:
您需要在初始化时为注释视图提供一个NSString作为重用标识符参数。
MKPinAnnotationView *customPinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:@"identifier"];https://stackoverflow.com/questions/17223757
复制相似问题