Ios 自定义MKAnnotation详图索引编号
我的应用程序映射页面中有一个要求。我必须自定义详图索引编号。我需要添加一个图像,两个标签和一个按钮,每个按钮具有特定的高度和宽度 我浏览了网页,找不到一个合适的链接来解释如何自定义标注气泡。如果你们中有人遇到或知道这件事,请与我分享 任何简单的例子或链接都会非常好 提前谢谢Ios 自定义MKAnnotation详图索引编号,ios,objective-c,iphone,mkmapview,mkannotation,Ios,Objective C,Iphone,Mkmapview,Mkannotation,我的应用程序映射页面中有一个要求。我必须自定义详图索引编号。我需要添加一个图像,两个标签和一个按钮,每个按钮具有特定的高度和宽度 我浏览了网页,找不到一个合适的链接来解释如何自定义标注气泡。如果你们中有人遇到或知道这件事,请与我分享 任何简单的例子或链接都会非常好 提前谢谢 suresh举个例子来帮助您: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)an
suresh举个例子来帮助您:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"loc"];
// Button
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.frame = CGRectMake(0, 0, 23, 23);
annotationView.rightCalloutAccessoryView = button;
// Image and two labels
UIView *leftCAV = [[UIView alloc] initWithFrame:CGRectMake(0,0,23,23)];
[leftCAV addSubview : yourImageView];
[leftCAV addSubview : yourFirstLabel];
[leftCAV addSubview : yourSecondLabel];
annotationView.leftCalloutAccessoryView = leftCAV;
annotationView.canShowCallout = YES;
return annotationView;
}
-(MKAnnotationView*)地图视图:(MKMapView*)地图视图注释:(id)注释
{
MKAnnotationView*annotationView=[[MKPinAnnotationView alloc]initWithAnnotation:annotation重用标识符:@“loc”];
//钮扣
UIButton*button=[UIButton button类型:UIButtonTypedTailButton];
button.frame=CGRectMake(0,0,23,23);
annotationView.rightCalloutAccessoryView=按钮;
//图像和两个标签
UIView*leftCAV=[[UIView alloc]initWithFrame:CGRectMake(0,0,23,23)];
[leftCAV添加子视图:yourImageView];
[leftCAV addSubview:yourFirstLabel];
[leftCAV addSubview:yourSecondLabel];
annotationView.leftCalloutAccessoryView=leftCAV;
annotationView.canShowCallout=是;
返回注释视图;
}
要了解更多信息,请查看以下内容:可能是hi anurag的重复,该帖子对我没有帮助。因为在哪里写openForAnnotation事件,以及当我点击annotation时如何连接视图。我不清楚。我正在寻找更详细的解释。如果你知道,请。。