实现searchBarSearchButtonClicked

时间:2013-10-23 14:05:26

标签: ios iphone objective-c cocoa-touch

我如何实现searchBarSearchButtonClicked方法?我试图在searchBarSearchButton点击标签时传递搜索栏的值。

2 个答案:

答案 0 :(得分:1)

 -(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
  [searchBar resignFirstResponder];

    yourlabel.text = searchBar.text;

    // DO what ever you want


  }

答案 1 :(得分:0)

像这样:

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
  _myLabel.text = searchBar.text;
}

就是这样!