import UIKit
classTestViewController:UIViewController{
overridefuncviewDidLoad() {
super.viewDidLoad()
//标题
self.title="会员注册"
//设置灰色背景
self.view.backgroundColor=UIColor(red:167/225, green:167/225, blue:167/225, alpha:1)
//设置左上角的图标
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)
//设置账号label
letlab =UILabel(frame:CGRect(x:0, y:240, width:68, height:60))
lab.text=" 🙍♂️账号"
lab.textColor = UIColor.gray
lab.font=UIFont.systemFont(ofSize:19)
lab.backgroundColor = UIColor.white
self.view.addSubview(lab)
// 设置账号文本框
lettf1 =UITextField(frame:CGRect(x:68, y:240, width:self.view.frame.size.width, height:60))
//设置文本框的背景颜色
tf1.backgroundColor = UIColor.white
//输入文本框的提示文字
tf1.placeholder="丨请输入手机号"
//将文本框添加到界面上
self.view.addSubview(tf1)
//设置密码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)
//设置密码输入框
lettf2 =UITextField(frame:CGRect(x:68, y:301, width:self.view.frame.size.width, height:60))
tf2.backgroundColor = UIColor.white
tf2.placeholder="丨请输入密码"
self.view.addSubview(tf2)
//设置确认密码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)
//创建确认密码输入框
lettf3 =UITextField(frame:CGRect(x:68, y:362, width:self.view.frame.size.width, height:60))
tf3.backgroundColor = UIColor.white
tf3.placeholder="丨请在此输入密码"
self.view.addSubview(tf3)
// 设置登录按钮
letbtn =UIButton(frame:CGRect(x:20, y:440, width: (self.view.frame.size.width-40), height:50))
btn.setTitle("注册", 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)
// 设置已有账号label
letlabel =UILabel(frame:CGRect(x:270, y:500, width:100, height:30))
label.text="已有账号?"
label.textColor = UIColor.gray
label.font=UIFont.systemFont(ofSize:15)
self.view.addSubview(label)
//设置登录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)
}
}