NSMutableDictionary and retirieving data from web
NSMutableDictionary and retirieving data from web
- Subject: NSMutableDictionary and retirieving data from web
- From: Ibrahim Bulut <email@hidden>
- Date: Mon, 12 Apr 2004 23:16:06 +0200
Hi all,
I have a problems with filling my tableview with data from my
NSMutableDictionary object. The problem is I get hold of the data from
an url wich is tab seperated data stream. Is there any way to fill a
NSDictionary object with this data and give the key names to the data
fields?
example:
NSMutableDictionary *rowData = [[NSMutableDictionary alloc] init];
[rowData setObject:@"12:00" forKey:@"programStart"];
[rowData setObject:@"13:00" forKey:@"programEnd"];
[rowData setObject:@"Channel1" forKey:@"programChannel"];
[rowData setObject:@"News" forKey:@"programTitle"];
[rowData setObject:@"News, sports and weather"
forKey:@"programDescription"];
[rowData setObject:NO forKey:@"programAlarm"];
[channelData addObject:rowData];
[rowData release];
Where channelData is my NSTableView's datasource. If I manually add
items to the rowData object it works fine, but I thought I would ask
you guys if there is a smarter method of doing things. Below is the way
I get my data and store it in an array, but I need to distinguish the
different fields and add keys names to them.
NSString* data2 = [[NSString alloc] initWithContentsOfURL:[[NSURL
alloc] initWithString:theUrl]];
NSMutableArray* myArray = [[NSMutableArray alloc] init];
[myArray addObjectsFromArray:[data2 componentsSeparatedByString:@"\t"]];
Anyone got any ideas to basically fill up an NSMutableDictionary with
keynames from url data?
Thanks.
/Ibrahim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.