如何在MapKit上覆盖搜索栏? [英] How can I overlay a search bar over MapKit?

查看:93
本文介绍了如何在MapKit上覆盖搜索栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MapKit上覆盖搜索栏?

我喜欢新的Google Maps应用程序具有一个悬停在地图上的搜索框和按钮的方式.

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

查看左侧的图片:

我不确定如何获得此信息,因为我已经为iOS编程了两个多星期了.关于如何使用Storyboards/Objective-C将UI元素彼此悬浮的任何想法?

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?

推荐答案

搜索框似乎是一个自定义控件,它模仿UISearchBar的行为,并且将从UIControl继承.由于UIControl继承自UIView,因此您可以将其添加到地图视图中

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. 使用addSubview:方法以编程方式
  2. 通过情节提要通过在适当的视图控制器中将自定义控件添加到地图中来

这篇关于如何在MapKit上覆盖搜索栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆