メモ。
NSTableView にデータを表示させる方法
http://rakuishi.com/archives/5535/
上記はdataSourceから文字を返すやり方。でも、たいていの人がやりたいのはCellを返すということだと思う。
任意のViewを返すのは、iPhoneと同じくdelegateから返す。
iPhoneと違うところは、カラムがあるところ。
下記の手順で設定する。
NSNib *cellNib = [[NSNib alloc] initWithNibNamed:@"MECategoryTableViewCell" bundle:nil];
[self.categoryTableView registerNib:cellNib forIdentifier:@"category_"];
self.categoryTableView.dataSource = self;
self.categoryTableView.delegate = self;
- viewForTableColumn内でmakeViewWithIdentifier:する。
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
MECategoryTableViewCell *cell = [tableView makeViewWithIdentifier:@"category_" owner:self];
[cell.textField setStringValue:[MECategory existCategories][row]];
return cell;
}