// 根据anntation生成对应的View 自定义大头针
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation
{
if([annotation isKindOfClass:[StoreAnnotation class]])
{ StoreAnnotation *storeAnnotation = (StoreAnnotation *)annotation;
NSString *annotationViewId = @"StoreAnnotation";
BMKAnnotationView *annotationView = (BMKAnnotationView *)[_mapView dequeueReusableAnnotationViewWithIdentifier:annotationViewId];
if(annotationView == nil)
{
annotationView = [[BMKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationViewId];
}
annotationView.contentMode = UIViewContentModeScaleAspectFit;
annotationView.image = kImageNamed(@"bike ");
//设置弹出气泡图片 自定义paopaoview
AnnotationView *subView = [[AnnotationView alloc] init];
subView.storeM = storeAnnotation.model ;
subView.frame = CGRectMake(0, -100, 198, 68);
_annotationView = subView;
BMKActionPaopaoView *pView = [[BMKActionPaopaoView alloc]initWithCustomView:subView];
pView.frame = CGRectMake(0, 0, 198, 68);
((BMKPinAnnotationView*)annotationView).paopaoView = nil;
((BMKPinAnnotationView*)annotationView).paopaoView = pView;
return annotationView;
}
return nil;
}