2012-03-21 108 views

回答

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 
} 
+0

和搜索顯示怎麼樣? 你可以用界面生成器來做到這一點嗎? – 2012-03-21 12:45:51

+0

[檢查出來](http://stackoverflow.com/questions/6520223/search-bar-display-controller) – Hemang 2012-03-21 12:55:31

+0

我已經看到它。我的問題是 - 我無法在搜索顯示控制器上找到任何文檔。另外,我非常好奇,爲什麼我無法將界面生成器中的搜索欄添加到地圖視圖中,而我可以將其添加到表視圖中。 – 2012-03-22 11:08:03

相關問題