2 つのセルベースのテーブルビュー (アイテムとカテゴリ) があります。それぞれの配列を操作できるように、それぞれの正しい行インデックスを取得しようとしています。
これまでの私のコードは次のとおりです。
- (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;
}
}
しかし、テーブルごとに、これは次のようなものを返します:
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
...
間違った方法を使用していますか、それとも何ですか? ありがとう。