第一个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.
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。