码迷,mamicode.com
首页 > 其他好文 > 详细

9_Permanent Storage

时间:2016-01-26 18:18:16      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

9

//
//  ViewController.swift
//  Permanent Storage
//
//  Created by ZC on 16/1/9.
//  Copyright © 2016年 ZC. 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.
        
        NSUserDefaults.standardUserDefaults().setObject("zcdll", forKey: "name")
        
        let userName = NSUserDefaults.standardUserDefaults().objectForKey("name")! as! String
        
        print(userName)
        
        let arr = [1,2,3,4,5]
        
        NSUserDefaults.standardUserDefaults().setObject(arr, forKey: "Array")
        
        let returnArray = NSUserDefaults.standardUserDefaults().objectForKey("Array")! as! NSArray
        
        for m in returnArray {
            
            print(m)
        }
        
    }

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


}

项目:9_Premanent Storage

9_Permanent Storage

标签:

原文地址:http://www.cnblogs.com/zcdll/p/5161094.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!