我有兩個基於單元格的表格(項目和類別)。我試圖得到正確的行索引,因此我可以使用它們的數組。使用兩個表格 - 如何獲得正確的行
到目前爲止我的代碼是這樣的:我使用了錯誤的方法,或者是我
currentCategory is Cat One
currentCategory is Cat Three
currentCategory is Cat One
currentCategory is Cat Three
currentCategory is Cat One
currentCategory is Cat Three
currentCategory is Cat Two
currentCategory is Cat One
currentCategory is Cat Three
...
:
- (id) tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(NSInteger)row {
//NSLog(@"%s", __FUNCTION__);
if (tableView.tag == 0) {
currentItem = [itemMutableArray objectAtIndex:row];
NSString *itemTitle1 = [currentItem valueForKey:@"title"];
return itemTitle1;
} else {
currentCategory = [categoryMutableArray objectAtIndex:row];
NSString *catName = [currentCategory valueForKey:@"name"];
NSLog (@"currentCategory is %@", catName);
return catName;
}
}
但每個表,這將返回類似?謝謝。
什麼問題了嗎? – Undo
我希望能夠識別每個表的特定行。 –
我們需要知道數組的內容以及日誌*應該說的內容。 – Undo