使用button创build自定义调用视图

我被困在一个地图查看问题,我在过去三天上网冲浪,但仍没有find任何适当的解决scheme。

我的问题是当我点击我自己定制的针脚时,会出现一个标注。 但标准的标注只支持两行文本。在我的情况下,我必须显示一个button四行文本。 请任何人告诉我如何创build一个自定义标注或应该使用什么方法,因为没有办法修改标准标注。

任何build议将不胜感激。 提前致谢。

在你的委托方法中

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { MKAnnotationView* annotationView = nil; //your code UIView *vw = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; vw.backgroundColor = [UIColor redColor]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 50, 50)]; label.numberOfLines = 4; label.text = @"hello\nhow are you\nfine"; [vw addSubview:label]; annotationView.leftCalloutAccessoryView = vw; return annotationView }