我有一個UITableView。我需要在單元格之間有空格,所以我所做的是,所有單元格都是分區,而區域之間的空格是分區頁腳。此外,我有一個UISearchBar頂部的表數據來搜索數據。 現在有一個小錯誤。UITableView:通過取消按鈕離開UISearchBar時的奇怪行
我點擊SearchBar。當我不做搜索時,只需直接單擊取消即可在主表視圖中獲取奇怪的行。見下面的圖1。
當我搜索並滾動搜索結果,然後單擊取消錯誤不會出現。 當我搜索並不滾動,但點擊取消,錯誤確實出現。
任何人都有一個想法,可能來自哪裏?
當cancelButton被點擊時,我試圖做setNeedsDisplay和reloadData,但都沒有工作。
以下是頁腳的代碼。
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return kZellenAbstand;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView* view = [[UIView alloc] init];
view.backgroundColor = [UIColor whiteColor];
return view;
}
Picture 1 http://img338.imageshack.us/img338/4877/iossimulatorbildschirmf.png
我縮小了範圍。如果我註釋掉view.backgroundColor = [UIColor whiteColor]; 該錯誤沒有出現,但表格視圖的背景是可見的,它不應該是。 – Quelk
其實,bug還是會出現,對標準clearcolor背景只是不可見。但是,我發現,在某些情況下,錯誤似乎是由消失的鍵盤觸發的。由於某種原因,消失的鍵盤會在第3-6節觸發viewForFooterInSection。 – Quelk