zoukankan      html  css  js  c++  java
  • plist的读取和写入

     1         // 从plist中读取数组数据
     2         let arrPath = Bundle.main.path(forResource: "ArrayPList", ofType: "plist")!
     3         let arr = NSArray(contentsOfFile: arrPath)!
     4         
     5         // 数组 写入 plist文件
     6         arr.write(toFile: "/Users/yaoshuai/Desktop/ArrP.plist", atomically: true)
     7         
     8         
     9         // 从plist中读取字典数据
    10         let dictPath = Bundle.main.path(forResource: "DictPList.plist", ofType: nil)!
    11         let dict = NSDictionary(contentsOfFile: dictPath)!
    12         
    13         // 字典 写入 plist文件
    14         dict.write(toFile: "/Users/yaoshuai/Desktop/DictP.plist", atomically: true)
  • 相关阅读:
    preprocess
    数组
    共用体
    动态内存管理函数
    C链表
    文件的定位与出错检查
    字符串读写函数
    C文件操作
    位运算
    爱好-超级IP:超级IP
  • 原文地址:https://www.cnblogs.com/panda1024/p/6251950.html
Copyright © 2011-2022 走看看