plist存取数据

 

//获取文件路径
    NSString *path = [[NSBundlemainBundle] pathForResource:@"user" ofType:@"plist"];
    //获取数据
    NSMutableDictionary* dict =  [[NSMutableDictionaryalloc] initWithContentsOfFile:path];
    NSString* object = [dict objectForKey:@"aaa"];
    NSLog(object);
 
    //修改数据
    NSMutableDictionary* dict = [[NSMutableDictionaryalloc] initWithContentsOfFile:path];
    [dict setObject:textview.text forKey:@"bbb"];
    [dict writeToFile:path atomically:YES];

你可能感兴趣的:(数据存取)