Another TableView question...
Another TableView question...
- Subject: Another TableView question...
- From: "Martha I. Espinosa" <email@hidden>
- Date: Tue, 25 Jan 2005 12:21:51 -0700
Hi,
My data is being read in using the init method. But, if the file
doesn't get created until half way through my application.
Therefore, my table is displaying nothing/zero/zip. Is there a way
that I can use the same code in a different method then call it or
reload it to get the data?
- (id)init
{
NSString *path = [NSString
stringWithFormat:@"/private/tmp/SWinstallers.txt", NSHomeDirectory()];
NSString *dataAsString = [NSString stringWithContentsOfFile:path];
NSArray *lines = [dataAsString componentsSeparatedByString:@"\n"];
int i, count;
count = [lines count];
software = [[NSMutableArray alloc] initWithCapacity:count];
for (i = 0; i < count; i++) {
NSArray *words = [[lines objectAtIndex:i]
componentsSeparatedByString:@","];
if ([words count] == 5) {
NSMutableDictionary *d = [NSMutableDictionary
dictionary];
[d setObject:[words objectAtIndex:0]
forKey:@"install"];
[d setObject:[words objectAtIndex:1] forKey:@"name"];
[d setObject:[words objectAtIndex:2]
forKey:@"esdname"];
[d setObject:[words objectAtIndex:3]
forKey:@"package"];
[d setObject:[words objectAtIndex:4] forKey:@"other"];
}
[software addObject:d];
}
}
NSLog(@"software = %@", software);
return self;
}
thanks in advance
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden