小夜曲


//
// ViewController.swift
// hasee
//
// Created by iwell on 14-12-19.
// Copyright (c) 2014年 IWELL.INC. All rights reserved.
//

import UIKit

class SignInController: UIViewController {

@IBOutlet weak var txt_username: UITextField!
@IBOutlet weak var txt_password: UITextField!

@IBAction func btn_signIn(sender: AnyObject) {
    if txt_username.text == ""{
        alert("请输入用户名")
    }
}

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.
}



func httpRequest(urlString:String){


}

func alert(message:String,title:String = "提示"){

    let alertController = UIAlertController(title: title, message: message,preferredStyle:.Alert);

    let defaultAction = UIAlertAction(title: "确认", style: .Default, handler: {
        (alertController : UIAlertAction!) in (
            self.txt_username.text = "abc")
            self.txt_password.text = "abc123"
    });

    let cancelAction = UIAlertAction(title: "取消", style: .Default, handler: nil);

    alertController.addAction(defaultAction);
    alertController.addAction(cancelAction);

    presentViewController(alertController,animated:true,completion:nil);

}

}

你可能感兴趣的:(小夜曲)