How can I overlay a search bar over MapKit?

白昼怎懂夜的黑 提交于 2019-12-11 04:19:17

问题


How can I overlay a search bar over MapKit?

I like how the new Google Maps application has a search box and buttons that hover over the map.

See the image on the left:

I'm not sure how to get this however as I have not been programming iOS for longer than a couple of weeks. Any ideas on how I could hover UI elements on top of each other with Storyboards/Objective-C?

Presumably it's a navigation bar that has been made invisible but how is this done, and how is it the Map appears underneath it?


回答1:


The search box appears to be a custom control which mimics behavior of a UISearchBar and which would inherit from UIControl. Since UIControl inherits from UIView, you can add it to your map view

  1. programatically with the addSubview: method
  2. via Storyboard by adding your custom control to your map in the appropriate view controller


来源:https://stackoverflow.com/questions/14092857/how-can-i-overlay-a-search-bar-over-mapkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!