Re: NSMutableDictionary and retirieving data from web
Re: NSMutableDictionary and retirieving data from web
- Subject: Re: NSMutableDictionary and retirieving data from web
- From: Ibrahim Bulut <email@hidden>
- Date: Tue, 13 Apr 2004 00:43:40 +0200
On Apr 12, 2004, at 23:59, Larry Fransson wrote:
On Apr 12, 2004, at 14:16, Ibrahim Bulut wrote:
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?
If I understand what you want, something like this should work:
NSArray *keyArray = [[NSArray alloc] initWithObjects:@"programStart",
@"programEnd", @"programChannel", @"programTitle",
@"programDescription", @"programAlarm", nil];
NSString *data2 = [[NSString alloc] initWithContentsOfURL:[[NSURL
alloc] initWithString:theUrl]];
NSArray *myArray = [[NSArray alloc] initWithArray:[data2
componentsSeparatedByString:@"\t"];
NSDictionary *rowData = [[NSDictionary alloc] initWithObjects:myArray
forKeys:keyArray];
[channelData addObject:rowData];
Does that look about right?
Hi again :)
Your example works for only for a single "row" at a time, so made a
loop and grabbed one "line" of my data at time and added it to the
tableview datasource.
Now it works perfectly.
Thanks for the help!
/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.