如何将 MapView 设为按钮(iPhone/iPad)?
目前,我的应用程序中有一个地图视图已锁定,因此用户无法与其交互(即滚动、缩放等),但是我想将其制作为 UIButton。这个想法是,可以按下地图视图,它将调用一个函数,就像按下 UIButton 一样。
我在网上寻找有关如何实现这一目标的想法,但我还没有找到任何东西。我尝试在地图视图的顶部制作一个 UIButton,但我似乎无法使其不可见。我还尝试将 IBAction 链接到地图视图,但是链接它的选项没有出现在连接检查器中(正如我所期望的诚实的那样 - 在黑暗中拍摄!)。
有什么办法可以达到这样的效果吗?
I currently have a map view in my app that is locked so that the user can't interact with it (i.e. scroll, zoom etc.), however I want to make it into a UIButton. The idea being the the can press the map view and it will call a function, the same way pressing a UIButton does.
I've had a look around online for ideas on how to achieve this but I haven't found anything yet. I tried making a UIButton over the top of the map view but I can't seem to make it invisible. I also tried linking an IBAction to the map view, however the option to link it doesn't appear in the connections inspector (as I expected to be honest - shot in the dark!).
Is there any way to achieve this effect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在地图上放置一个 UIButton,就像您之前尝试过的那样。但要使其不可见,请将按钮类型从“圆形矩形”更改为“自定义”。这将使按钮不可见,除非您明确地将图像添加到按钮。
-干杯
You can place a UIButton over the map, just like you tried before. But to make it invisible, change the button type from Round Rect to Custom. This will make the button invisible unless you explicitly add an image to the button.
-Cheers