![](/img/trans.png)
[英]Animating custom callout for MKAnnotationView in MKMapView with “pop in” effect
[英]custom callout in Mkmapview in ios
我必须在ios中的注解单击上显示自定义视图,我必须在自定义视图中显示7张图像,名称和详细信息显示按钮。 在单击详细信息披露按钮后,我必须调用新的视图控制器。 我该怎么办?
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
// Define your reuse identifier.
MKPinAnnotationView *annotationView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
annotationView.pinColor = MKPinAnnotationColorGreen;
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
// Adding Button on annotation callout which is your detail disclosure button//
UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0.0f,0.0f,28.0f,22.0f)];
[rightButton setImage:[UIImage imageNamed:@"rightArrow.png"] forState:UIControlStateNormal];
[rightButton addTarget:self
action:@selector(pressDetailBtn:)
forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
annotationView.image=[UIImage imageNamed:@"orangePin.png"];
annotationView.opaque = NO;
return annotationView;
}
-(void)pressDetailBtn:(id)sender
{
YourVC code here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.