我想保存在文本文件中我的应用程序数据文件夹 我使用下面的方法来存储,但它存储单个字符串我想,我的数据是在数组怎么可能阵列中的所有内容存储在文本文件中保存数据从iPhone应用程序在iPhone应用程序的文本文件
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString*[email protected]"This is working fine";
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"file.txt"];
NSString *stringWithoutSpaces = [yourString stringByReplacingOccurrencesOfString:@" " withString:@""];
[stringWithoutSpaces writeToFile:filePath atomically:TRUE encoding:NSUTF8StringEncoding error:NULL];
我的数组就像下面
DataController *coffeeObj = [appDelegate.coffeeArray objectAtIndex:indexPath.row];
cell.resturantLocationLabel.text=coffeeObj.resturantLocation;
cell.foodQualityRatingLabel.text=coffeeObj.foodQualityRating;
cell.foodPresentationRatingLabel.text=coffeeObj.foodPresentationRating;
cell.waiterRatingLabel.text=coffeeObj.waiterRating;
cell.ambienceRatingLabel.text=coffeeObj.ambienceRating;
cell.overallRatingLabel.text=coffeeObj.overallRating;
cell.commentsLabel.text=coffeeObj.comments;
cell.emailAddressLabel.text=coffeeObj.emailAddress;
cell.addtoMailingListLabel.text=coffeeObj.addtoMailingList;
NSString*test=coffeeObj.comments;
什么是数组数据?我们可以有样品吗? – 2012-07-09 06:17:49