美文网首页
登录,注册页面

登录,注册页面

作者: 张皓男 | 来源:发表于2016-11-21 18:34 被阅读0次

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    // Override point for customization after application launch.

    self.window = UIWindow(frame:UIScreen.main.bounds)

    self.window?.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)

    self.window?.makeKeyAndVisible()

    self.window?.rootViewController = UIViewController()

    let ImageView = UIImageView(frame:CGRect(x: 157, y: 20, width: 100, height: 100))

    ImageView.image = #imageLiteral(resourceName: "a.jpeg")

    ImageView.layer.cornerRadius = 50

    ImageView.layer.masksToBounds = true

    self.window?.addSubview(ImageView)

    let Lable = UILabel(frame:CGRect(x: 50, y: 140, width: 50, height: 40))

    Lable.text = "账号"

    Lable.backgroundColor = #colorLiteral(red: 0.9880268512, green: 0.9258960921, blue: 1, alpha: 1)

    Lable.layer.cornerRadius = 10

    Lable.layer.masksToBounds = true

    self.window?.addSubview(Lable)

    Lable.tag = 200

    let textField = UITextField(frame:CGRect(x: 120, y: 140, width: 264, height: 40))

    textField.backgroundColor = #colorLiteral(red: 0.8976129821, green: 0.6902934195, blue: 0.9686274529, alpha: 1)

    textField.borderStyle = .roundedRect

    textField.placeholder = "请输入账号"

    textField.clearsOnBeginEditing = true

    textField.keyboardType = .emailAddress

    textField.layer.cornerRadius = 10

    textField.layer.masksToBounds = true

    self.window?.addSubview(textField)

    let Lable2 = UILabel(frame:CGRect(x: 50, y: 200, width: 50, height: 40))

    Lable2.text = "密码"

    Lable2.backgroundColor = #colorLiteral(red: 0.9880268512, green: 0.9258960921, blue: 1, alpha: 1)

    Lable2.layer.cornerRadius = 10

    Lable2.layer.masksToBounds = true

    self.window?.addSubview(Lable2)

    Lable2.tag = 200

    let textField2 = UITextField(frame:CGRect(x: 120, y: 200, width: 264, height: 40))

    textField2.backgroundColor = #colorLiteral(red: 0.8976129821, green: 0.6902934195, blue: 0.9686274529, alpha: 1)

    textField2.layer.cornerRadius = 10

    textField2.layer.masksToBounds = true

    textField2.borderStyle = .roundedRect

    textField2.placeholder = "请输入密码"

    textField2.clearsOnBeginEditing = true

    textField2.keyboardType = .emailAddress

    textField2.isSecureTextEntry = true

    self.window?.addSubview(textField2)

    let button = UIButton(frame:CGRect(x: 50, y: 260, width: 50, height: 40))

    button.setTitle("登录", for: .normal)

    button.backgroundColor = #colorLiteral(red: 0.922887975, green: 0.7753175045, blue: 1, alpha: 1)

    button.layer.cornerRadius = 10

    button.clipsToBounds = true

    self.window?.addSubview(button)

    button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)

    let Button2 = UIButton(type: .custom)

    Button2.setTitle("注册", for: .normal)

    Button2.backgroundColor = #colorLiteral(red: 0.922887975, green: 0.7753175045, blue: 1, alpha: 1)

    Button2.layer.cornerRadius = 10

    Button2.clipsToBounds = true

    Button2.frame = CGRect(x: 330, y: 260, width: 50, height: 40)

    self.window?.addSubview(Button2)

    Button2.addTarget(self, action: #selector(Button2Action), for: .touchUpInside)

    return true

    }

    // MARK:- button的点击事件

    func buttonAction()  {

    print("登录成功")

    }

    // MARK:- playButton的点击事件

    func Button2Action(button:UIButton)  {

    print("注册成功")

    }

    相关文章

      网友评论

          本文标题:登录,注册页面

          本文链接:https://www.haomeiwen.com/subject/zgiupttx.html