获取文件路径
- (NSString *)getFilePath
{
         2.获取所要存储的文件路径
           (1)获取Documents文件夹路径
             NSDocumentDirectory 用来获取指定文件夹的路径
             NSUserDomainMask 设置查找的域,我们的自己的文件都是存储在用户域的
             @param yes 是否使用详细路径(绝对路径)
             @return 因为最初该方法是适用于MAC OS的,而对于电脑系统可能有对个用户,所以获取到的路径可能有多条,所以返回值类型是数组,但对于iOS下,就只有一个用户,所以数组中只有一个元素.
        

    NSString * documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
           

            (2)拼接上要存储的文件路径.
    NSString * newFilePath = [documentsPath stringByAppendingPathComponent:@"aa.txt"];
    return newFilePath;
}



         字符串从本地文件读取
            每次写入都会将之间的内容覆盖.如果想保留之前的数据,需要先将之间的数据读出,然后和将要存储的数据拼接在一起.
    

           NSString * content = [NSString stringWithContentsOfFile:[self getFilePath] encoding:NSUTF8StringEncoding error:nil];
           self.fileview.TFView.text = content;
    
        

        数组从本地文件读取
       
            NSArray * arr = [NSArray arrayWithContentsOfFile:[self getFilePath]];
            self.fileview.TF.text = arr.lastObject;
            self.fileview.TFView.text = arr.firstObject;
    
  

        字典读取本地文件
            NSDictionary * dic = [NSDictionary dictionaryWithContentsOfFile:[self getFilePath]];
           self.fileview.TF.text = dic[@"tf2"];
           self.fileview.TFView.text =dic[@"tf1"];