2015-07-20 34 views
0

我在我的應用程序中有一個搜索欄,但是我遇到了問題,因爲當用戶單擊搜索圖標時,搜索欄會顯示上次搜索的結果。這是發生的,但正如你所看到的,我不能選擇行表格。如果我嘗試這個視圖和鍵盤消失,當我想做一個新的搜索與結果表不再顯示。沒有顯示搜索欄的結果表

enter image description here

enter image description here

任何IDEEA爲什麼?

回答

0

你用過SearchBar和SearchDisplayController嗎? 如果, 然後在你的tableview數據源的方法,你應該在NumberOfRowsInSection的tableview數據源和方法也CellForRowAtIndexPath使用條件下,其顯示如下

If(tableview == myTableView) { 

    // Count for Your TableView 
    // Display Results for Tableview . Which will be by default 

} else { 

    // Count for SearchTableView 
    // Show Result for Search TableView 
} 

你也需要在.h文件中使用SearchBarDelegate 。