加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift 学习笔记

发布时间:2020-12-14 02:35:59 所属栏目:百科 来源:网络整理
导读:第一个swift app project ViewController.swift // // ViewController.swift // MyFirstApp // // Created by hins on 16/3/26. // Copyright ? 2016年 hins. All rights reserved. // import UIKit class ViewController: UIViewController { @IBAction fun

第一个swift app project
ViewController.swift

//
// ViewController.swift
// MyFirstApp
//
// Created by hins on 16/3/26.
// Copyright ? 2016年 hins. All rights reserved.
//


import UIKit

class ViewController: UIViewController {

    @IBAction func TouchMe(sender: UIButton) {
        //print("hello app");//点击文字事件时控制台输出

        // 弹窗
        let msgBox = UIAlertController(title: "this is title",message: "this is content",preferredStyle: UIAlertControllerStyle.Alert);
        //弹窗里的按钮
        //let msgAction = UIAlertAction(title: "confirm",style: UIAlertActionStyle.Default) { (_) in}

        let msgAction = UIAlertAction(title: "confirm",style: UIAlertActionStyle.Default) { (_) in print("you touch button!")}

        msgBox.addAction(msgAction);

        self.presentViewController(msgBox,animated: true,completion: nil);
    }

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

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


}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读