Je suis débutant avec Cocoa Touch, j'ai un problème que je tente de comprendre. J'apprécierai si quelqu'un pourrait aider.Tableau est vide après la fonction
Je voudrais créer une tableDataList à afficher sur la table. AsyncViewController appelle la méthode TableHandler fillList pour initialiser les données de la table. Mais après l'appel fillList, la tableDataList retourne vide.
Quelqu'un peut-il m'expliquer ce problème?
Dans "AsyncViewController.m":
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[self.myHandler fillList];
[super viewDidLoad];
}
Dans "TableHandler.m":
@implementation TableHandler
#define ItemNumber 20
@synthesize tableDataList;
- (void) fillList {
NSMutableArray *array = [NSMutableArray arrayWithCapacity:(NSUInteger) 20];
for (NSUInteger i = 0; i < ItemNumber; i++) {
[array addObject:[NSString stringWithFormat:@"Row %d", i]];
}
tableDataList = [NSArray arrayWithArray:array];
}
Merci
Bonjour Stephen, comment puis-je formater ma question comme vous l'avez fait pour moi? Merci – haisergeant
Je pense que vous pouvez frapper 'edit' pour voir comment il l'a formaté. – Kalle
Sinon, il y a un orange vif "?" boîte à côté du champ d'édition sur lequel vous pouvez cliquer pour obtenir toutes sortes d'informations utiles. Il va ici: http://stackoverflow.com/editing-help – Kalle