How to write the data to the plist

后端 未结 1 1697
梦毁少年i
梦毁少年i 2021-01-20 22:28

HI can u send me sample code to add the data to the .plist. .my plist was in this format as follows.kindly help me out



        
相关标签:
1条回答
  • 2021-01-20 23:33

    I guess something like this would work (not very good at iphone stuff):

    // Loading
    NSString *path = ...
    NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:path];
    
    // Manipulating
    NSObject *newElement = ...
    [array addObject:newElement];
    
    // Storing
    [array writeToFile:path atomically:YES];
    

    By pressing "ALT" + double clicking on a class name opens up the docu for this class along with a list of methods and so on. Take a look there, too!

    0 讨论(0)
提交回复
热议问题