如何解决在Mkannotation图像上添加Labeltext
| 我正在使用带有自定义placeMark的MKMapView,它具有NSString值,我想将其作为标签添加到mkannotationview图像。- (MKAnnotationView *)mapView:(MKMapView *)MapView viewForAnnotation:(MyPlaceMark *)annotation{
static NSString* AnnotationIdentifier = @\"AnnotationIdentifier\";
MKAnnotationView* MyView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
MyView.canShowCallout=YES;
MyView.image = [UIImage imageNamed:@\"MyImage.png\"];
return MyView;}
这是获得它的最佳方法,我尝试在图像上添加标签,但是CGRect出现问题,我一无所获,不知道如何制作它
谢谢!
解决方法
注解视图绘制图像?在这种情况下,我将添加UILabel作为子视图。
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x,y,width,height)];
[yourView addSubview:label];
[label release];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。