1.创建pliet文件
new file->Resource->Property List 输入plist文件名称
2.Root 和Item的设置
Root类型设置为Array, item类型设置为dictionary,
3.
var CellInfor : NSMutableArray!
let bundle = NSBundle.mainBundle() // 创建bundle let plistPath : String! = bundle.pathForResource("videos",ofType: "plist")//videos MyCellInfor // 初始化plist文件路径 CellInfor = NSMutableArray(contentsOfFile: plistPath) //将plist文件中的内容读入<span style="font-family: Arial,Helvetica,sans-serif;">MutableArray</span>
4.读取
let row = indexPath.row let rowDict : NSDictionary = CellInfor.objectAtIndex(row) as! NSDictionary cell.MyCellTitle.text = rowDict.objectForKey("Title") as? String cell.MyCellDetail.text = rowDict.objectForKey("Detail") as? String原文链接:https://www.f2er.com/swift/325952.html