Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm writing an application for the iPad that will tell us whether or not someone is on court at a tennis tournament. Basically, just an application with a list of names each with an on/off button next to them. Once the on button is pressed, their name turns red, thus they are on court.

Is there any way, to make this easier for myself, I would be able to connect it to my computer and load in a list of names once the application is complete? That would save me from having to individually enter/modify names manually.

Thanks in advance, Louis.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

Though your question is pretty... vague, one suggestion :

importing Spreadsheet-like data could easily be done by import the .csv version (Comma-separated value) of a Spreadsheet.

A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal TAB or comma. Usually, all records have an identical sequence of fields.

Example :

Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38

Then, you could simply :

(1) Load your csv file as a simple text file

NSString* contents = [NSString stringWithContentsOfFile:filename
                                               encoding:NSUTF8StringEncoding 
                                                  error:nil];

(2) Get the lines

NSArray* lines = [contents componentsSeparatedByString:@"
"];

(3) Parse each line's fields

for (NSString* line in lines)
{
    NSArray* fields = [line componentsSeparatedByString:@","];
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...