пример с привязкой object.value в конструкторе интерфейса:
// InfoToBind.h
@interface InfoToBind : NSObject {
NSString *kSurname ;
NSString *kName ;
NSInteger kNumberRow;
}
@property (nonatomic, retain) NSString * kSurname ;
@property (nonatomic, retain) NSString *kNameKey ;
@property (nonatomic, assign) NSInteger kNumberRow;
// InfoToBind.m
@syntesize ...
// делегат.m
#import "InfoToBind.m
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
InfoToBinb *infoBind = [InfoToBind alloc]init];
images = [[NSMutableArray alloc]init];
//example
InfoDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
@"name", @"Giulio", @"surname", @"Cesare", nil];
NSMutableArray dataSourceArray = [NSMutableArray alloc]init];
infoBind.kName = [InfoDictionary objectForKey:@"Name"];
infoBind.kSurname = [InfoDictionary objectForKey:@"Surname"];
NSUInteger x;
for (x = 0; x <= dasourceArray.count; x++) {
infoBind.kNumberRow ++;
}
[dataSourceArray addObject:myClass];
[_tableView insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:dataSourceArray.count] withAnimation:NSTableViewAnimationSlideLeft];
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView{
return [dataSourceArray count];
}
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
// Used by bindings on the NSTableCellView's objectValue
NSDictionary *item = [dataSourceArray objectAtIndex:row];
NSLog(@"item is %@", item);
return item;
}
// перетащить TextField в CellView и привязать его к «представлению ячейки таблицы» и добавить это значение: objectValue.kNumberRow
![et voilà](https://i.stack.imgur.com/X5tzS.png)