write data line by line on iphone

后端 未结 4 1343
抹茶落季
抹茶落季 2020-12-11 08:37

i can write to a text file on iphone..but each time i write my previous value is erased, is there any way to keep writing data separated by \\n??

this is my code

4条回答
  •  情深已故
    2020-12-11 09:18

    I dont fully understand the question, but you could try each time you are saving the text, first read the text already in the file then use the stringByAppendingString.For example, the code

    NSString *begRainbow = @"Red orange yellow green";
    NSString *fullRainbow = [begRainbow stringByAppendingString:@" blue purple"];
    

    Leaves fullRainbow with a value of "Red orange yellow green blue purple".

提交回复
热议问题