添加搜索栏并搜索显示控制器到地图视图?

时间:2012-03-21 12:03:28

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

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

1 个答案:

答案 0 :(得分: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
}