![](/img/trans.png)
[英]tableView:cellForRowAtIndexPath: not getting called when using searchbar
[英]SearchBar text empty when searchBarSearchButtonClicked called
我已經在我的視圖 controller 中實現了 searchBarSearchButtonClicked 委托方法
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
searchBar.text = textView.text
}
單擊“搜索”按鈕但 searchBar.text 屬性為空時,成功調用該方法。
任何想法為什么 searchBar.text 會是空的?
您應該使用“searchBar.text”中的值,而不是將“textView.text”的值分配給它。 嘗試這個:
注釋此“searchBar.text = textView.text”並添加“NSLog(@"%@",searchBar.text);"
現在在您的日志中檢查搜索欄的值。 如果您已將搜索欄的代表連接到文件的所有者,您還可以檢查您的 XIB 文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.