需要先看著一篇
http://www.reibang.com/p/53bcec5e9ba6
下面咱們就說一下自定義氣泡
代碼搞起來
BMKActionPaopaoView 這里只是創(chuàng)建一個(gè)view也就是彈出來的氣泡
PPXPointAnnotation 繼承BMKShape
@interface PPXPointAnnotation : BMKShape
{
@package
CLLocationCoordinate2D _coordinate;
}
///該點(diǎn)的坐標(biāo)
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (strong) NSString *title1;
@property (strong) NSString *title2;
@end
ok下面我們就可以使用了
#pragma mark 設(shè)置大頭針
-(BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id<BMKAnnotation>)annotation
{
if([annotation isKindOfClass:[BXMKPointAnnotation class]])
{
BMKPinAnnotationView *newAnnotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"];
newAnnotationView.pinColor = BMKPinAnnotationColorRed;
newAnnotationView.animatesDrop = YES;// 設(shè)置該標(biāo)注點(diǎn)動(dòng)畫顯示
newAnnotationView.draggable = NO;
KHPaoPaoView *paopao = [[KHPaoPaoView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
[paopao setAnnotationWith:((PPXPointAnnotation *)annotation)];
newAnnotationView.paopaoView = [[BMKActionPaopaoView alloc] initWithCustomView:paopao];
newAnnotationView.annotation=annotation;
// newAnnotationView.image = [UIImage imageNamed:@"bx.jpg"]; //把大頭針換成別的圖片
return newAnnotationView;
}
return nil;
}
當(dāng)然你也可已在上面加相應(yīng)的點(diǎn)擊事件然后進(jìn)入到相應(yīng)的界面