标签:
首先初始化一个要展示的泡泡视图
paopaoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 80)]; paopaoView.layer.cornerRadius = 10; paopaoView.layer.borderColor = [UIColor lightGrayColor].CGColor; paopaoView.layer.borderWidth = 2; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 160, 80)]; label.numberOfLines = 0; label.text = @"上地三街36号 吃6块钱的麻辣烫上地三街36号 吃6块钱的麻辣烫上地三街36号 吃6块钱的麻辣烫"; label.textColor = [UIColor redColor]; label.font = [UIFont systemFontOfSize:13]; [paopaoView addSubview:label];
设置坐标点处的annotation
-(void)viewDidAppear:(BOOL)animated{ BMKPointAnnotation *annotation = [[BMKPointAnnotation alloc] init]; CLLocationCoordinate2D coor; coor.latitude = 40.0424920000; coor.longitude = 116.3182870000; annotation.coordinate = coor; [_mapView addAnnotation:annotation]; }
代理方法实现
-(BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id<BMKAnnotation>)annotation{ if([annotation isKindOfClass:[BMKPointAnnotation class]]){ BMKPinAnnotationView *newAnnotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"]; // newAnnotationView.animatesDrop = YES; newAnnotationView.annotation=annotation; //大头针图片 newAnnotationView.image = [UIImage imageNamed:@"1.jpg"]; newAnnotationView.paopaoView = [[BMKActionPaopaoView alloc]initWithCustomView:paopaoView]; [newAnnotationView setSelected:YES animated:YES]; return newAnnotationView; } return nil; }
标签:
原文地址:http://www.cnblogs.com/machealking/p/4644599.html