简体   繁体   English

iOS:MapView中的图像视图

[英]iOS: Image view inside MapView

I'm starting to iOS develop. 我开始进行iOS开发。

I have a UIMapView , and I want to show an image on the top of this UIMapView . 我有一个UIMapView ,我想在此UIMapView的顶部显示一个图像。 But, when I drag a UIImageView to my UIMapView , the UIImageView superimposes my UIMapView . 但是,当我将UIImageView拖到UIMapViewUIImageView叠加我的UIMapView How can I set the position of the UIImageView to top and continue to show the map? 如何将UIImageView的位置设置为顶部并继续显示地图?

You can't do this in interface builder. 您不能在界面生成器中执行此操作。 You might be able to do this programatically. 您可能可以通过编程方式执行此操作。

UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
[self.mapView addSubView:image];

You'll have to fix the origin of exactly where you want to place the image on the map however. 但是,您必须确切地确定要将图像放置在地图上的原点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM