我試圖在UITableView
內執行UISearchBar
,其行爲與iPod應用程序的「藝術家」選項卡中的行爲相同。UITableView -reloadSectionIndex標題未調用數據源
我有隱藏導航欄,並調整搜索框的大小以顯示「取消」按鈕等,但無法讓它隱藏部分索引標題。
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
inSearchMode_ = YES; // tell sectionIndexTitlesForTableView: to return nil
tableView_.scrollEnabled = NO; // works correctly, var is definitely wired
[tableView_ reloadSectionIndexTitles]; // doesn't call sectionIndexTitlesForTableView:
...
我錯過了什麼嗎?是UITableView -reloadSectionIndexTitles
壞了?
通常我對這種事情的迴應是打電話給reloadData
,但是這有副作用導致UISearchBar
失去焦點。
這聽起來很像UISearchDisplayController的運行方式,現在我已經玩過樣本了。 – chrisbtoo 2010-07-02 17:40:50