自定义地图注释标注图像
我可以设置 MKPinAnnotationView 的标题、副标题、左侧图像 (leftCalloutAccessoryView) 和右侧按钮 (rightCalloutAccessoryView)。
使用此代码,我将图像设置在左侧:
UIImageView *myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Icon.png"]];
myImageView.frame = CGRectMake(0, 0, 10, 10);
customPinView.leftCalloutAccessoryView = myImageView;
[myImageView release], myImageView = nil;
结果如下:
图片 1
但我想要得到这样的东西:
图片 2 图像与字幕对齐的位置。
怎样才能得到呢?
谢谢。
I'm able to set the MKPinAnnotationView with title, subtitle, an image on the left (leftCalloutAccessoryView) and a button on the right (rightCalloutAccessoryView).
With this code i set the image on the left:
UIImageView *myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Icon.png"]];
myImageView.frame = CGRectMake(0, 0, 10, 10);
customPinView.leftCalloutAccessoryView = myImageView;
[myImageView release], myImageView = nil;
The result is something like this:
Image 1
but I would like to get something like this:
Image 2
where the image is aligned with the subtitle.
How can get it?
Thx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将需要使用自定义的annotationView。开发人员资源中有大量关于此的文档。无法使用默认注释样式进行图像对齐。
That's going to require using a custom annotationView. There's plenty of documentation about this in the developer resources. There's no way to do that image alignment using the default annotation style.