Property Listをつかってみよう -5
Property Listをつかってみよう -4 - Macアプリつくるブログ
のつづきです。
まず、下の図のように、File's OwnerからControllerにCtrl+ドラッグ、
delegateを選択します。
続いては、テーブルです。
同様にして、Table ViewをControllerにCtrl+ドラッグし、
こちらは"dataSource"を選びます。
さらに、Controller.mに、
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
return self.phoneNumbers.count;
}
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(NSInteger)row {
return [phoneNumbers objectAtIndex:row];
}
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
[phoneNumbers replaceObjectsAtIndexes:[NSIndexSet indexSetWithIndex:row]
withObjects:[NSArray arrayWithObject:object]];
}
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/PropertyLists/QuickStartPlist/QuickStartPlist.html#//apple_ref/doc/uid/10000048i-CH4-SW5
を追記します。
ここまでが、インターフェースづくりになります。
次は、Property Listへの読み書きをやりたいと思います。