swift获取plist文件
VC里面获取文件路径搭建界面
import UIKit
class ViewController: UIViewController ,UITableViewDelegate,UITableViewDataSource{
var tbv:UITableView?
var nameArr:[String] = []
var dict:NSDictionary = [:]
var data:NSMutableDictionary = [:]
var marr:NSMutableArray = []
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// 生成文件的存储路径
let plistPath = Bundle.main.path(forResource: "plist", ofType: "plist")
// let plistPath = Bundle.main.path(forResource: "1", ofType: "plist")
//读取属性列表文件,并转化为可变字典对象
data = NSMutableDictionary(contentsOfFile: plistPath!)!
// marr = NSMutableArray(contentsOfFile: plistPath!)!
// print(marr)
nameArr = data.allKeys as! [String]
tbv = UITableView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
view.addSubview(tbv!)
tbv?.delegate = self
tbv?.dataSource = self
tbv?.register(UITableViewCell.self, forCellReuseIdentifier: "idCell")
}
func tableView(_ tableView: UITableView, numberOfRowsInSec