RE: newbie question....reading from flat file
RE: newbie question....reading from flat file
- Subject: RE: newbie question....reading from flat file
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Thu, 22 Jan 2004 17:31:01 -0500
OK, you're sort of off on the wrong foot here.
First, table views don't "store" information, they merely display it.
Typically, you set up a "model" object to hold the data and a "datasource"
to mediate between the table view and the data. Read the programming topics
on Table Views and Model-View-Controller design for more. You can access
the docs through XCode's help menu.
Second, you would really benefit from a quick browse throught the docs for
the common Foundation classes, particularly NSString, NSArray, NSDictionary
and their mutable subclasses. You'll find NSString has built-in support for
turning delimited text into arrays. Hint: componentsSeparatedByString: The
basic approach is to slice a string at line breaks, so that it turns into an
array of substrings. Then enumerate over the array and turn each substring
into a dictionary. The datasource can use this array of dictionaries to
feed the table view.
I'd stay away from NSScanner unless I had some more complicated parsing to
do. By all means, read the NSScanner docs, but scanners are overkill for
this problem.
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Martha Espinosa
>
Sent: Thursday, January 22, 2004 3:37 PM
>
To: email@hidden
>
Subject: newbie question....reading from flat file
>
>
>
Hi again,
>
>
Okay, I have started my "software update" application. I need some
>
guidance. I created a table in project builder and want to use a
>
flat file with information separated by commas stored up on a network
>
server. I want to get the information from the flat file and store
>
it in the table. I know you can use NSScanner and NSString. Can
>
someone be nice enough and help me figure this out?
>
>
Thanks in Advance
>
>
-ME
>
_______________________________________________
>
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.
_______________________________________________
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.