IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]swift手记-1

    u010255642发表于 2016-01-17 22:45:37
    love 0
    //
    //  ViewController.swift
    //  mylearn
    //
    //  Created by liuxing on 16/1/17.
    //  Copyright (c) 2016年 myhaspl. All rights reserved.
    //
    
    import Cocoa
    
    class ViewController: NSViewController {
        var nowvalue:Bool=true
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            // Do any additional setup after loading the view.
        }
    
        override var representedObject: AnyObject? {
            didSet {
            // Update the view, if already loaded.
            }
        }
    
    
        @IBOutlet weak var helloButton: NSButton!
        @IBAction func showHello(sender: AnyObject) {
            if nowvalue {
                self.helloButton.title="您好,世界"
                nowvalue=false
            }
            else{
                self.helloButton.title="hello,world"
                nowvalue=true
            }
        }
    }
    

    反复按下hello,world按钮,将轮流显示中英文






沪ICP备19023445号-2号
友情链接