swift 学习笔记

前端之家收集整理的这篇文章主要介绍了swift 学习笔记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

第一个swift app project
ViewController.swift

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


import UIKit

class ViewController: UIViewController {

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

        @H_403_4@// 弹窗
        let msgBox = UIAlertController(title: "this is title",message: "this is content",preferredStyle: UIAlertControllerStyle.Alert);
        @H_403_4@//弹窗里的按钮
        @H_403_4@//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()
        @H_403_4@// Do any additional setup after loading the view,typically from a nib.
    }

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


}

猜你在找的Swift相关文章