0
我在下面的代表中使用了这个,并在注释中设置图像。当点击注释时,它的didselectannotation委托不会被调用。但是,当我使用默认然后它的工作。请建议是否有人可以在这方面提供帮助。当点击注解地图位置不缩放
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
static NSString *defaultPinID = @"Annotation";
pinView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (pinView == nil)
pinView = [[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID];
UIImage *originalImage = [UIImage imageNamed:@"map.png"];
pinView.canShowCallout = YES;
pinView.image = [self drawImage:originalImage inRect:CGRectMake(0, 0, 106, 148)];
pinView.calloutOffset = CGPointMake(0, -5);
UIImageView *profileImageView = [[UIImageView alloc]init];
profileImageView.frame = CGRectMake(6, 7, 40, 40);
[profileImageView setImage:[UIImage imageNamed:@"user.png"]];
[profileImageView setBackgroundColor:[UIColor whiteColor]];
[self setRoundedAvatar:profileImageView toDiameter:40 atView:self.view];
[pinView addSubview:profileImageView];
检查此问题http://stackoverflow.com/questions/29179473/mkannotationview-subviews – Muneeba