swift 登录界面

self.title = “会员注册”

    self.navigationController?.navigationBar.barTintColor = UIColor.gray
    
    self.view.backgroundColor = UIColor.white
    
    
    let item = UIBarButtonItem(title: "<", style: UIBarButtonItem.Style.plain, target: self, action: nil)
    self.navigationItem.leftBarButtonItem = item
    

    
    // 设置图片
    let imgV = UIImageView(image: UIImage(named: "QQicon"))
    imgV.frame = CGRect(x: (self.view.frame.size.width-100)/2, y: 100, width: 100, height: 100)
    imgV.layer.masksToBounds = true
    imgV.layer.cornerRadius = 50
    self.view.addSubview(imgV)
    
    
    // 设置文本框
    let tf1 = UITextField(frame: CGRect(x: 0, y: 220, width: self.view.frame.size.width, height: 70))
    tf1.layer.borderWidth = 0.3
    tf1.layer.borderColor = UIColor.gray.cgColor
    tf1.placeholder = "    账号 | 请输入手机号"
    tf1.font = UIFont.systemFont(ofSize: 18)
    self.view.addSubview(tf1)
    
    let tf2 = UITextField(frame: CGRect(x: 0, y: 290, width: self.view.frame.size.width, height: 70))
    tf2.layer.borderWidth = 0.3
    tf2.layer.borderColor = UIColor.gray.cgColor
    tf2.placeholder = "    密码 | 请输入密码"
    tf2.font = UIFont.systemFont(ofSize: 18)
    self.view.addSubview(tf2)
    
    let tf3 = UITextField(frame: CGRect(x: 0, y: 360, width: self.view.frame.size.width, height: 70))
    tf3.layer.borderWidth = 0.3
    tf3.layer.borderColor = UIColor.gray.cgColor
    tf3.placeholder = "    密码 | 请在此输入密码"
    tf3.font = UIFont.systemFont(ofSize: 18)
    self.view.addSubview(tf3)
    
    
    
    // 设置登录按钮
    let btn = UIButton(frame: CGRect(x: 20, y: 460, 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.blue
    self.view.addSubview(btn)
    
    // 设置label
    let label = UILabel(frame: CGRect(x: 270, y: 520, width: 100, height: 30))
    label.text = "已有账号?"
    label.textColor = UIColor.gray
    label.font = UIFont.systemFont(ofSize: 15)
    self.view.addSubview(label)
    
    
    let btn1 = UIButton(frame: CGRect(x: 350, y: 520, width: 50, height: 30))
    btn1.setTitle("登录", for: UIControl.State.normal)
    btn1.setTitleColor(UIColor.blue, for: UIControl.State.normal)
    btn1.layer.borderWidth = 1
    btn1.layer.borderColor = UIColor.blue.cgColor
    self.view.addSubview(btn1)

猜你喜欢

转载自blog.csdn.net/weixin_43656520/article/details/86551821