Salut tout le monde,
Je voudrais avoir cotre avis concernant le code suivant à savoir pourquoi il naffiche pas le contenu de larray dans la TableView? Lidentifier de la seul colonne présente étant identifMe. Jai déclarer les fonctions dans le header file de même que larray et le dictionary.
Daprès moi le problème doit venir de return records; puisque [records count ]; ne retourne rien. Mais je sais pas pourquoi. Merci davance.
#import "myDataSource.h"
@implementation myDataSource
- (NSMutableArray *) records{
myDict = [[NSMutableDictionary alloc]init];
records = [[NSMutableArray alloc] init];
[myDict setObject:@"Pottier" forKey: @"identifMe"];
[records addObject: myDict];
return records;
}
- (int)numberOfRowsInTableView
NSTableView *)aTableView{
return [records count];
}
- (id)tableView
NSTableView *)aTableView
objectValueForTableColumn
NSTableColumn *)aTableColumn
row
int)rowIndex
{
id theRecord, theValue;
NSParameterAssert(rowIndex >= 0 && rowIndex < [records count]);
theRecord = [records objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:@"identifMe"];
return theValue;
}
Je voudrais avoir cotre avis concernant le code suivant à savoir pourquoi il naffiche pas le contenu de larray dans la TableView? Lidentifier de la seul colonne présente étant identifMe. Jai déclarer les fonctions dans le header file de même que larray et le dictionary.
Daprès moi le problème doit venir de return records; puisque [records count ]; ne retourne rien. Mais je sais pas pourquoi. Merci davance.
#import "myDataSource.h"
@implementation myDataSource
- (NSMutableArray *) records{
myDict = [[NSMutableDictionary alloc]init];
records = [[NSMutableArray alloc] init];
[myDict setObject:@"Pottier" forKey: @"identifMe"];
[records addObject: myDict];
return records;
}
- (int)numberOfRowsInTableView

return [records count];
}
- (id)tableView

objectValueForTableColumn

row

{
id theRecord, theValue;
NSParameterAssert(rowIndex >= 0 && rowIndex < [records count]);
theRecord = [records objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:@"identifMe"];
return theValue;
}