我有一個SearchDisplayController和TableView中的tableView財產申報或連桿
在.H視圖(搜索查看):
@property (nonatomic, retain) IBOutlet UITableView *tableView;
我聯繫這的.xib文件中的TableView:>
然後在cellforrow:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
if(listGoal){
Goal *goalz = nil;
if (tableView == self.searchDisplayController.searchResultsTableView)
{
goalz = [self.filteredListContent objectAtIndex:indexPath.row];
cell.textLabel.text = goalz.goalNaam;
}
else
{
goalz = [arr objectAtIndex:indexPath.row];
cell.textLabel.text = goalz.goalNaam;
cell.detailTextLabel.text = goalz.goalBeschrijving;
}
}
我測試是否需要filteredListContent或原始數組arr。 (因爲我使用的是SearchDisplayController) 哪個工作正常。
在另一種方法,
if (tableView == self.searchDisplayController.searchResultsTableView)
不工作了,所以我嘗試使用
self.tableView
但這也不工作,
(UITableView *)tableView
不工作無論是。 我知道我的財產聲明或鏈接有問題,但是出了什麼問題?
我認爲searchTableView只有在屏幕上顯示時纔可用。 哪種方法不適合你? –
在一個自定義方法中,在同一個類中。我怎樣才能以正確的方式調用tableview? – Fuzej