plist 读取 swift

//
// ViewController.swift
// plist读写
//
// Created by mac on 15/7/13.
// Copyright (c) 2015年 fangyuhao. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

// var arr = NSArray(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("test", ofType: "plist")!)!)
var arr:NSDictionary = NSDictionary(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("test", ofType: "plist")!)!)!
var name:String = arr["name"] as! String
println("name:(name)")
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

posted @ 2016-12-16 23:28  乱笙歌  阅读(362)  评论(0编辑  收藏  举报