【问题标题】:Adding a search bar and search display controller to a map view?将搜索栏和搜索显示控制器添加到地图视图?
【发布时间】:2012-03-21 12:03:27
【问题描述】:

我正在尝试将搜索栏和搜索显示添加到地图视图中。我实际上并不关心如何处理搜索请求,我当前的问题是如何将搜索栏和搜索显示控制器添加到地图视图以及如何设置它。我找不到有关此主题的任何最新文档。

【问题讨论】:

    标签: iphone objective-c search android-mapview searchbar


    【解决方案1】:
    //Add and bind Searchbar Controller to your viewcontroller
    
    - (void) viewDidLoad
    {
        //Don't forget to add <UISearchBarDelegate> into your .h file
        yourSearchbar.delegate=self;
    }
    
    //implement search bar delegate
    - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar 
    {
        NSLog(@"%@",searchBar.text);
    
        //next you've to setup logic to pass search text to your mapview
    }
    

    【讨论】:

    • 那么搜索显示呢?你能用界面生成器做到这一点吗?
    • 我看过了。我的问题是 - 我在搜索显示控制器上找不到任何文档。另外,我很好奇为什么不能在界面生成器中将搜索栏添加到地图视图中,而我可以将其添加到表格视图中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    • 1970-01-01
    相关资源
    最近更新 更多