swift plist文件
发布时间:2020-12-14 01:48:54 所属栏目:百科 来源:网络整理
导读: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 : Stri
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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |