saving multiple nsstring into one savefile
I'm stuck at one of the last parts of my iApp, can someone help me?
I want to add different field entries of different .m files into one file without overwriting the file. (I also dont know how to make that save file btw).
I have 2 .h files with :
file1 : NSString *dataHML;
NSString *dataHML2;
file2 : NSString *dataHML3;
NSString *dataHML4;
I have in the first file1.m file :
-(IBAction)FirstSelection:(id)sender {
UIImage *img = [UIImage imageNamed:@"sf5.png"]; [displayCharacterHML setImage:img];
if (count == 5)
{ UIImage *img = [UIImage imageNamed:@"High-s.png"];
if (img != nil) {
[displayHML setImage:img];
dataHML = [[NSString alloc] initWithFormat:@"H"];
count = 6;
}
}
-(IBAction)SecondSelection:(id)sender {
UIImage *img = [UIImage imageNamed:@"sf6.png"]; [displayCharacterHML setImage:img];
if (count == 5)
{ UIImage *img = [UIImage imageNamed:@"Medium-s.png"];
if (img != nil) { [displayHML2 setImage:img];
dataHML2 = [[NSString alloc] initWithFormat:@"M"]; count = 6;
}}}
then in the second file2.m i have :
-(IBAction)ThirdSelection:(id)sender {
UIImage *img = [UIImage imageNamed:@"sf6.png"]; [displayCharacterHML setImage:img];
if (count == 5)
{ UIImage *img = [UIImage imageNamed:@"High-s.png"];
if (img != nil) {
[displayHML3 setImage:img];
dataHML3 = [[NSString alloc] initWithFormat:@"H"];
count = 6;
}
}
-(IBAction)SecondSelection:(id)sender {
UIImage *img = [UIImage imageNamed:@"sf6.png"]; [displayCharacterHML setImage:img];
if (count == 5)
{ UIImage *img = [UIImage imageNamed:@"Medium-s.png"];
if (img != nil) { [displayHML4 setImage:img];
dataHML4 = [[NSString alloc] initWithFormat:@"M"];
count = 6; } }
How do i make the dataHML, dataHML2, dataHML3 and dataHML4 being saved into one save file with each on their own line?
If you can explain me this ill be very grateful, i've red things with NSUserdefault etc. but i couldn't make allot of sense of it since my question is quite specific.
Last edited by ruiter; 05-24-2010 at 06:40 AM.
|