在地图视图上方添加固定按钮
我有一个非常简单的问题,可能简单得可笑。我目前有一个正在使用route-me 和OpenStreetMap 的应用程序,基本上我有一个将地图加载到整个窗口中的视图。
当尝试在 Interface Builder 中将按钮添加到此视图来运行项目时,地图会加载到按钮上方,并且不会显示。
地图视图由自定义类 RMMapView (route-me 类)加载,并且我已经知道如何向地图本身添加标记,但不知道如何在屏幕一角添加不会随着用户拖动而移动的固定按钮周围的地图。我想将按钮添加为叠加层,即地图视图本身之上的视图。
如果你们能给我任何关于如何做到这一点的提示,我将不胜感激。
谢谢。
I have a really quick question which is probably ridiculously simple. I currently have an application that I am using route-me and OpenStreetMap, and basically I have a view that loads the map into the entire window.
When trying to run the project with a button added to this view in Interface Builder, the map loads overtop of the button, and is not displayed.
The map view is loaded by a custom class RMMapView (route-me class), and I already know how to add markers to the map itself, but not a stationary button in the corner of the screen that won't move as the user drags the map around. I want to add the button as an overlay, a view overtop of the map view itself.
If you guys could give me any tips on how to do this I would greatly appreciate it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许这有帮助。
Maybe this helps.
将mapView作为子视图添加到视图中,并将按钮作为子视图添加到同一视图中。
Add the mapView as a subview to a view, and add the button as a subview to the same view.
在 Interface Builder 中,在包含所有场景的左侧窗格中,切换按钮和 MapView 的位置。如果该按钮列在 MapView 上方,请将其向下拖动,使其位于其下方。反之亦然。这将改变哪个视图位于另一个视图之上。
In Interface Builder, on the left side pane that has all the scenes, switch the positions of the button and the MapView. If the button is listed above the MapView, drag it down so it's below it.. or vice versa. This will change which view is on top of the other.