ios NSArray数组写plist的文件的代码

好久没更新了,今天分享一下

这个方法主要是把数组写入一个plist中  简单但挺实用的。

-(void)writeToPlist:(NSArray *)uploadingfiles  Name:(NSString *)name
{
        
        NSMutableArray *sList = [[NSMutableArray alloc ]initWithCapacity:[uploadingfiles count] * 2];
        
        for(uploadfile* tmp in uploadingfiles)  
        {
            if(tmp.filename)
                [sList addObject :tmp.filename];
            else {
                [sList addObject :@""];
            }
            if(tmp.filesize)
                [sList addObject :tmp.filesize];
            else {
                [sList addObject :@""];
            }       
        }
        
        [sList writeToFile:getFullPath(name) atomically:YES];
        
}



你可能感兴趣的:(Iphone,开发)