0

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

4

1 回答 1

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
}
于 2012-03-21T12:27:13.453 回答