1
我想使用分段控件在「兩個」表之間切換,但我不確定什麼是最好的方法。我應該真的創建2個表並更改分段控制值更改時的隱藏屬性,或者我應該更改數據源和全局屬性,然後幫助我檢測哪些數據,我想要顯示?iOS 2 UITableViews和更改隱藏屬性或更改源1
如果每個表格都有相同的自定義單元格,那麼我認爲最好的方法是使用一個表格。但是我爲每個表創建了2個自定義單元格(xib和自定義類,因爲內容有點不同),所以我不確定。像這樣在cellForRowAtIndexPath:
if(_firstContent)
CellIdentifier = @"trackIdentifier";
else
CellIdentifier = @"otherIdentifier";
UITableView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
if(_firstContent)
{
[tableView registerNib:[UINib nibWithNibName:@"PanelTrackCell" bundle:nil] forCellReuseIdentifier:CellIdentifier;
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
}
else
{
[tableView registerNib:[UINib nibWithNibName:@"PanelOtherCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
}
}
這是很好的方法嗎?