Create, save, and read text file
I want to open one blank new text file on a button event, 开发者_如何转开发edit the text, and save it in a directory, and also read that file at any time.
You can read a text file into a string with this method on NSString:
+ (id)stringWithContentsOfFile:(NSString *)path
usedEncoding:(NSStringEncoding *)enc
error:(NSError **)error
You can write it again with:
- (BOOL)writeToFile:(NSString *)path
atomically:(BOOL)useAuxiliaryFile
encoding:(NSStringEncoding)enc
error:(NSError **)error
精彩评论