import UIKit
classTestViewController:UIViewController{
? ? overridefuncviewDidLoad() {
? ? ? ? super.viewDidLoad()
? ? ? ? //標(biāo)題
?? ? self.title="會(huì)員注冊(cè)"
? ? ? ? //設(shè)置灰色背景
? ? ? ? self.view.backgroundColor=UIColor(red:167/225, green:167/225, blue:167/225, alpha:1)
? ? ? ? //設(shè)置左上角的圖標(biāo)
? ? ? ? self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "<", style: UIBarButtonItem.Style.done, target: self, action: nil)
? ? ? ? //添加imgview
? ? ? ? letimgV =UIImageView(image:UIImage(named:"QQicon"))
? ? ? ? imgV.frame=CGRect(x: (self.view.frame.size.width-100)/2, y:130, width:100, height:100)
? ? ? ? imgV.layer.masksToBounds = true
? ? ? ? imgV.layer.cornerRadius = 50
? ? ? ? self.view.addSubview(imgV)
? ? ? ? //設(shè)置賬號(hào)label
? ? ? ? letlab =UILabel(frame:CGRect(x:0, y:240, width:68, height:60))
? ? ? ? lab.text=" ???♂?賬號(hào)"
? ? ? ? lab.textColor = UIColor.gray
? ? ? ? lab.font=UIFont.systemFont(ofSize:19)
? ? ? ? lab.backgroundColor = UIColor.white
? ? ? ? self.view.addSubview(lab)
? ? ? ? // 設(shè)置賬號(hào)文本框
? ? ? ? lettf1 =UITextField(frame:CGRect(x:68, y:240, width:self.view.frame.size.width, height:60))
? ? ? ? //設(shè)置文本框的背景顏色
? ? ? ? tf1.backgroundColor = UIColor.white
? ? ? ? //輸入文本框的提示文字
? ? ? ? tf1.placeholder="丨請(qǐng)輸入手機(jī)號(hào)"
? ? ? ? //將文本框添加到界面上
? ? ? ? self.view.addSubview(tf1)
? ? ? ? //設(shè)置密碼label
? ? ? ? letlab1 =UILabel(frame:CGRect(x:0, y:301, width:68, height:60))
? ? ? ? lab1.text=" ??密碼"
? ? ? ? lab1.textColor = UIColor.gray
? ? ? ? lab1.font=UIFont.systemFont(ofSize:19)
? ? ? ? lab1.backgroundColor = UIColor.white
? ? ? ? self.view.addSubview(lab1)
? ? ? ? //設(shè)置密碼輸入框
? ? ? ? lettf2 =UITextField(frame:CGRect(x:68, y:301, width:self.view.frame.size.width, height:60))
? ? ? ? tf2.backgroundColor = UIColor.white
? ? ? ? tf2.placeholder="丨請(qǐng)輸入密碼"
? ? ? ? self.view.addSubview(tf2)
? ? ? ? //設(shè)置確認(rèn)密碼label
? ? ? ? letlab2 =UILabel(frame:CGRect(x:0, y:362, width:68, height:60))
? ? ? ? lab2.text=" ??密碼"
? ? ? ? lab2.textColor = UIColor.gray
? ? ? ? lab2.font=UIFont.systemFont(ofSize:19)
? ? ? ? lab2.backgroundColor = UIColor.white
? ? ? ? self.view.addSubview(lab2)
? ? ? ? //創(chuàng)建確認(rèn)密碼輸入框
? ? ? ? lettf3 =UITextField(frame:CGRect(x:68, y:362, width:self.view.frame.size.width, height:60))
? ? ? ? tf3.backgroundColor = UIColor.white
? ? ? ? tf3.placeholder="丨請(qǐng)?jiān)诖溯斎朊艽a"
? ? ? ? self.view.addSubview(tf3)
? ? ? ? // 設(shè)置登錄按鈕
? ? ? ? letbtn =UIButton(frame:CGRect(x:20, y:440, width: (self.view.frame.size.width-40), height:50))
? ? ? ? btn.setTitle("注冊(cè)", for:UIControl.State.normal)
? ? ? ? btn.setTitleColor(UIColor.white, for: UIControl.State.normal)
? ? ? ? btn.backgroundColor=UIColor(red:43/225, green:145/225, blue:235/225, alpha:1)
? ? ? ? self.view.addSubview(btn)
? ? ? ? // 設(shè)置已有賬號(hào)label
? ? ? ? letlabel =UILabel(frame:CGRect(x:270, y:500, width:100, height:30))
? ? ? ? label.text="已有賬號(hào)?"
? ? ? ? label.textColor = UIColor.gray
? ? ? ? label.font=UIFont.systemFont(ofSize:15)
? ? ? ? self.view.addSubview(label)
? ? ? ? //設(shè)置登錄button
? ? ? ? letbtn1 =UIButton(frame:CGRect(x:350, y:500, width:50, height:30))
? ? ? ? btn1.setTitle("登錄", for:UIControl.State.normal)
? ? ? ? btn1.setTitleColor(UIColor(red:43/225, green:145/225, blue:251/225, alpha:1), for:UIControl.State.normal)
? ? ? ? btn1.layer.borderWidth=1
? ? ? ? btn1.layer.borderColor=UIColor(red:43/225, green:145/225, blue:251/225, alpha:1).cgColor
? ? ? ? self.view.addSubview(btn1)
? ? }
}